David Jarrin
David Jarrin

Reputation: 1749

Can't update my $PATH variable MacOS

I'm using MacOS High Sierra and I am not able to update my $PATH variable. I have tried updating my ~/.bash_profile, ~/.bashrc and even my ~/.profile files but none of these update my $PATH file. I even downloaded a GUI for setting ENV variables, that GUI does seem to be setting the variables but it can't update the PATH variable (damn).

The code I am using looks much like this:

export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=${JAVA_HOME}/bin:$PATH
export PATH=${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools:$PATH
export PATH=$PATH:$GRADLE_HOME/bin

When I paste "export PATH=${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools:$PATH" into my terminal and write the command "android" I get the desired result but I obviously want this to happen all the time not just when I paste that in. When I start a new terminal session I just get "zsh: command not found: android". This is driving me nuts, any ideas?

Upvotes: 2

Views: 3292

Answers (1)

Bogdan Stoica
Bogdan Stoica

Reputation: 4539

Since your using ZSH as shell, you have to put those changes in ~/.zshrc file not in .bashrc

Then issue a source ~/.zshrc to reload and it should work as expected

Upvotes: 7

Related Questions