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 ?
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.
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
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With