How to create aliases in the macOS Terminal

September 09, 2018
I'm making an alternative to DevTools. Click here to check it out.

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 zeph that opens this website in a browser. There should not be any space between the alias name, the =, and the quoted command.

alias zeph="open 'https://zeph.co'"

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.