I am trying to set permanent environmental variable in my mac machine
I have tried following steps till now –
vi ~/.bash_profile
-
adding my variable
export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home export ANDROID_HOME=/usr/local/share/android-sdk export ANDROID_SDK_ROOT=/usr/local/share/android-sdk
-
restarted the bash
source ~/.bash_profile
For current terminal its loaded the variable, but if I open another terminal
its not showing newly added variable if I check with printenv
.
How can I make bash
set the variables?
Best Answer
For newly created accounts Catalina uses
zsh
instead ofbash
, so you need to add the lines to the appropriate file (probably~/.zshenv
to make sure it's read in all cases).