-bash: android: command not found on Mac OSX
Step 0
The first step is install Android SDK: https://developer.android.com/studio
I don't like the default configurations. I installed SDK in this folder:
/Users/<Username>/Android\ SDK
ℹ️ The default path is
$HOME/Library/Android/sdk
Step 1
The next command open your bash or zshrc configuration file:
Bash profile:
vim ~/.bash_profile
If you use zsh:
vim ~/.zshrc
Step 2
You're ready to update your configurations:
# File: .bash_profile | .zshrc
# Custom path to Android SDK folder.
# If you use the default configuration please change ANDROID_HOME to $HOME/Library/Android/sdk
export ANDROID_HOME=/Users/<Username>/Android\ SDK
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
Step 3
Option 1:
Restart your terminal and you should be able to use android
command
Option 2: source your bash
or zsh
profile.
Example: source ~/.bash_profile
/ source ~/.zshrc
The android
tool is located in the tools
directory in your SDK. You need to add this to your PATH
environment variable so that bash can recognize it.
You can do this by adding it to your PATH
in your .bash_profile
file. This file should be located in your home directory. Create if it doesn't exist using vi .bash_profile
and add the following line to it:
export PATH=<path_to_android_sdk>/platform-tools:<path_to_android_sdk>/tools:$PATH
where <path_to_android_sdk>
is to be replaced with the path to your SDK. For example: "/Users/me/android-sdk-mac_86/platform-tools"
I spent so much time trying to figure out, this steps helped me ( from http://docs.phonegap.com/en/2.2.0/guide_getting-started_android_index.md.html )
You need to execute your .bash_profile
to update your PATH
.
Set up your PATH environment variable on Mac OS
Open the Terminal program (this is in your Applications/Utilites folder by default). Run the following command
touch ~/.bash_profile; open ~/.bash_profile
This will open the file in the your default text editor. You need to add the path to your Android SDK platform-tools and tools directory. In my example I will use "/Development/android-sdk-macosx" as the directory the SDK is installed in. Add the following line:
export PATH=${PATH}:/Development/android-sdk-macosx/platform-tools:/Development/android-sdk-macosx/tools
Save the file and quit the text editor. Execute your .bash_profile
to update your PATH:
source ~/.bash_profile
Now every time you open the Terminal program you PATH
will included the Android SDK.
Problem Solved For Android Studio Users:
I am using Mac OS X Elcapitan version 10.11.X.
Under my home directory I found .bash_profile.save file. I opened that file using sublime (you can use any other editor). Then I added this line
export PATH=${PATH}:/Users/UserName/Library/Android/sdk/platform-tools:/Users/UserName/Library/Android/sdk/tools
Replace "UserName" with your UserName.
open terminal then run
source ~/.bash_profile
here you go.