How to set path in bash_profile on macos catalina 10.15?

If you've never touched these files before then they won't exist on your machine to begin with you'll need to create them in your home directory. Then you'll be able to benefit from their capabilities.

[Edit]

To create it open your Terminal and enter the following commands.

cd ~/ This will put you in your home directory where these applications look for these files

touch .bash_profile .zshrc This will create the two files for you to edit and add your statements into. Since they start with a period they will be hidden so you'll either need to edit them with VIM or something of the sort or show hidden files. Then edit with the text editor of your choosing.


go easy:

nano .zprofile

So for example for scala:

export PATH=$PATH:/usr/local/scala/bin

Ctl X and save...


macOS Catalina uses .zprofile instead of .bash_profile

cd && touch .zprofile && open .zprofile

This command will create and open a .zprofile file, and every path you save in the file will be permanently available on the terminal.

Android SDK paths for examples:

export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

Update for MacOS Monterey: Use .zshrc instead of .zprofile

Tags:

Macos