DEV Community

StuartCreed
StuartCreed

Posted on

10 2

How to add aliases to your terminal on Mac OS

A source of potential confusion

As a default MacOS now (since the beginning of 2019) ships with zsh shell (compiler in /bin/zsh) rather than bash shell (compiler in /bin/bash) in the terminal. This means that if you look in forums etc for information about aliases for MacOS and .bashrc and .bash_profile files are mentioned this is no longer relevant. You can change the default back to bash but this is not recommended, zsh is deemed better (generally) hence why they changed the default. I personally have deleted the .bashrc and .bash_profile file in my home directory (cd or cd ~ to get to your home directory) to avoid confusion.

To add an alias for zsh

cd ~
nano .zshrc
Enter the alias e.g:
alias l='ls -lrtah'
Press Ctrl + X and then Save.
To make these changes have affect you then need to run:
source .zshrc

Now if I run l in the terminal ls -lrtah will be run instead

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (3)

Collapse
 
joelwafotalom profile image
JOEL WAFO

thanks so much for this article. exactly what i was looking for

Collapse
 
kverma_dev profile image
Kunal Verma

Thank you for the article !!
This really helped me 🙂

Collapse
 
stuartcreed profile image
StuartCreed

Glad it helped 🙂

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more