Mac OSX

Where is bash_profile in macOS Catalina or Big Sur?

Developers and power users are among the many who are attempting to find bash_profile in macOS Catalina or Big Sur. The right question is, Is there bash_profile configuration available in Catalina? The answer is no. When Apple released Catalina back in 2019, they migrated the default shell from bash to Zsh (Z Shell). Therefore, the subsequent version of Catalina, Big Sur also continues to have Zsh instead of bash as default shell. Let’s explore how can you actually update your shell profile using Zsh.

Open, Edit zsh profile in macOS Catalina, Big Sur

As we know, bash is not available starting from Catalina, therefore, we need to use zsh. Apple made the shift due to licensing issues. Let’s edit and open zsh profile configuration file. We’ll make a user specific process instead of making system wide changes.

Open terminal in mac and write the following command:

nano ~/.zprofile

After writing the above command, you are into bash_profile equivalent of zsh. Considering, you are an advanced user, here you can write configurations, setup environment variables and add other concerned changes in the profile. The .zprofile might be empty in the beginning, as you haven’t created it before. After adding concerned configuration you simply need to save the .zprofile by pressing ctrl+o.

Equivalent of .bash_profile and .bashrc in macOS Catalina or Big Sur

After knowing that Apple has discontinued bash starting from Catalina, it’s worth noting the alternatives which it offers. Since, we all know by now that instead of bash, z shell is now present in these macOS versions, therefore following are the simple equivalencies:

  • .bash_profile in Catalina, Big Sur is .zprofile
  • .bashrc in Catalina, Big Sur is .zshrc

Therefore, if you are confused that why bash_profile is not being included in your mac terminal, probably you just need to rename your profile. After renaming, or creating a different configuration file, Z Shell will start to include it for your terminal session.

Conclusion:

Z shell is flexible and anyone using bash shell for long can easily switch to z shell. The configuration is almost same and environment variables work the same way in both shells. Z Shell is much more customisable as compared with bash. In case of macOS, starting from Catalina and the other two versions namely Big Sur and Monterey, Apple is keeping /bin/zsh as the default terminal shell. Therefore, all you need to do is to change your configuration files to the new ones. Similarly, while using terminal you need to remember to use .zprofile instead of .bash_profile.