Not sure about Mac. But in linux which is very simliar I do something like this in my .bashrc
and .bash_profile
. Here you can see where I have set my JAVA_HOME. After modified those files you will have to logout and them login for the path to take affect.
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
export JAVA_HOME=/home/steve/.local/share/android-studio/jre
export GRADLE_HOME=/opt/gradle/gradle/bin
export ADB=/home/steve/Android/Sdk/platform-tools
export ANDROID_HOME=/home/steve/Android/Sdk
And
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$JAVA_HOME/bin:$ADB:$ANDROID_HOME
export PATH