MacOS – environment variable not showing after set

catalinaenvironment-variablesmacos

I am trying to set permanent environmental variable in my mac machine
I have tried following steps till now –

  1. vi ~/.bash_profile
  2. 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
    
  3. 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 of bash, so you need to add the lines to the appropriate file (probably ~/.zshenv to make sure it's read in all cases).