3 easy steps to set ANDROID_HOME environment variable in mac permanently

As an android developer some times you need to use terminal commands. I mostly use it to connect my testing device wirelessly. If the ANDROID_HOME path is not set it can be annoying to set path every time you use ADB command. Following are the 3 steps you can follow to set ANDROID_HOME path permanently.

Video Tutorial

Step 1: Open terminal and open bash_profile in edit mode

Simply open your terminal(you can use command+space and type terminal hit enter). and write following command.

vim ~/.bash_profile

(Here is a secret! You can use nano as well to edit bash_profile)

Press ‘i’ key for inserting text.

Add your Android SDK path as below:

export ANDROID_HOME=/Users/$USER/Library/Android/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH

Once added press [Esc] key and write “:wq” and hit [return] for write the file and quit.

Step 2: Update changes in terminal

In this step you tell the system that some chnages are added to the user_profile file. To update changes write following command and hit enter.

source ~/.bash_profile

Step 3: Test the ADB commands

Now validate the path variable as below:

echo $PATH

All set now test ADB commands. Try running any command like one below.

adb devices

All set! All the best for your new app.

Sanjeev Jikamade

Hello, I’m an experienced mobile developer and a Data Science enthusiast from Mumbai. I have special interest in exploring technological advancements and write about it in my blog. I love reading, mostly about biographies, self help, psychology. You can explore here some blog posts about my reading experiences mixed up with my thoughts about life. Happy Reading :)

Back to top