Mark Thomas Miller's logo

Creating your own aliases in the macOS Terminal

September 9, 2018

If you want to create aliases in the macOS terminal (whether you're using bash or zsh), you can do the following:

  1. In Terminal, run:

    # If you're using bash
    cd && open -e .bash_profile
    # If you're running zsh
    cd && open -e .zshrc
  2. In the opened file, add your alias. For this example, I'll make a command mtm that opens this website in a browser. There should not be any space between the alias name, the =, and the quoted command.

    alias mtm="open ''"
  3. Save the file.

  4. Restart Terminal.

  5. Now you can run your command.

That's all you need to do to set an alias in the macOS Terminal.