Creating your own aliases in the macOS Terminal

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.

About the author

I'm Mark Thomas Miller, a full stack engineer and designer currently working at ConvertKit. (We're hiring!) People like Arnold Schwarzenegger, Lindsey Stirling, and Tim Ferriss use features I've built to connect with their fans. I'm currently geeking out about Svelte, mechanical keyboards, and minimalist UI design, and replaying Ocarina of Time.