Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set path in bash_profile on macos catalina 10.15?

Tags:

macos

Recently I have installed macos 10.15 (catalina) and I am installing some software which need to set their paths like java_home.

But I am not able to find .bash_profile or .zshrc ?

like image 395
Muhammad Avatar asked Oct 20 '19 04:10

Muhammad


People also ask

How do I set the path on Mac Catalina?

Since macOS uses zsh as the default shell on Catalina (and above) versions, you just need to edit either the . zshrc or . zsh_profile file and add the path of your program or script.


3 Answers

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

like image 99
Guillaume250 Avatar answered Oct 22 '22 07:10

Guillaume250


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.

like image 9
Aaron Kippins Avatar answered Oct 22 '22 07:10

Aaron Kippins


go easy:

nano .zprofile

So for example for scala:

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

Ctl X and save...

like image 2
ingconti Avatar answered Oct 22 '22 07:10

ingconti