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.
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:$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.