If you want to create aliases in the macOS terminal (whether you’re using bash or zsh), you can do the following:
-
In Terminal, run:
# If you're using bash cd && open -e .bash_profile # If you're running zsh cd && open -e .zshrc
-
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 'https://mtm.dev'"
-
Save the file.
-
Restart Terminal.
-
Now you can run your command.
That’s all you need to do to set an alias in the macOS Terminal.