How to Open .bash_profile file in Mac Terminal

The .bash_profile is a hidden configuration file for Bash Shell that you will find under the logged-in user's home directory.

The easiest way to get there is by opening the Terminal and typing cd ~

Next, you can make use of the nano editor, which is a very easy-to-use built-in editor in macOS.

To open the .bash_profile simply type nano ~/.bash_profile

Example:

Opening .bash_profile file on Mac
The .bash_profile file opened in Nano on Mac Terminal

Note: It is common that this file may not be present, if not created.

Once you make changes to this file, press Control + X followed by Y to save and Quit.

Finally, to apply the changes run the command source ~/.bash_profile in Terminal.

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!