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

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

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 🙂

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up