Shell Config File on Mac

Published: Feb 28, 2022
Updated: Mar 3, 2022

When writing about things like tool installation or environment setup on Mac, I often need to mention shell config files. So, instead of doing that each time, I’m going to (hopefully) write about it once, then reference it as needed.

Which Shell Am I Currently Running? #

Starting with Catalina, Zsh is the default shell. (You can change it back to Bash if you like).

You can check which shell you’re currently running with the below command 1.

ps -p $$

Which Config File Should I Use? #

On Mac, the Terminal app defaults to a login shell 2. So, assuming you haven’t messed with the Terminal settings, you can make changes to the login config file, then expect those changes to show up in new Terminal windows or tabs.

Note: If the login config file for your shell doesn’t yet exist, create it.

Reference #

Shell Location Login Config File Interactive Config File
Bash /bin/bash ${HOME}/.bash_profile ${HOME}/.bashrc
Zsh /bin/zsh ${HOME}/.zprofile ${HOME}/.zshrc

  1. Explained: ps is a tool for checking the status of a process. The -p option accepts a comma-separated list of process ids. $$ is a special variable that holds the process id of the currently running shell. ↩︎

  2. Read more about login vs interactive config files↩︎