From the shell:
open /Applications/TextEdit.app .bash_profile
Edit the file and save it.
You’ll add lines like:
export FOO=value
Close your shell windows and re-open.
You can do something like the following to verify what you set:
echo $FOO
If it doesn’t show up, check the file permissions.
ls –l .bash_profile
If it isn’t -rw-r–r—you’ll want to change it:
chmod 644 .bash_profile
Inside the shell, you can re-run the .bash_profile by executing:
.~/.bash_profile
The . command sources a shell script in your current environment. You can use that to quickly edit and test on the command line without quitting and re-opening the shell.
I also have java installed for selenium webdriver. I do I need to install anything else java related? Do I need to find install JAVA_HOME location as well?
I often find that it’s best to point the new user to a tutorial. This is a pretty good one on setting an environment variable in bash:
I encourage you to read this, this is the kind of knowledge that will take you a long way in your career.
For your specific problem, JAVA_HOME should be set when Java is installed on the machine. If it’s not, on my machine (10.11.6) you can set it in your ~/.bash_profile to:
export JAVA_HOME=/usr/libexec/java_home
Which is a symbolic link to the actual Java installed on your machine. Once you’ve done that you can ‘source ~/.bash_profile’ to have the system add your changes and then you should be able to ‘echo $JAVA_HOME’ to verify that the environment variable is set.
It seems that android SDK is no longer available to download separately. If you want to use android sdk you will have to download android studio. Once you are in android studio. Select ‘configure’ and select ‘sdk manger’ from the options.
New update:
If anyone is having problems installing Andriod studio I have FINALLY FIGURED IT OUT and it works mac os el capitan 10.11.6
download Android Studio
1a. Open terminal after download and installation
2.‘vim ~/.bash_profile’
3.source ~/.bash_profile
ANDROID_HOME: place your Andriod SKD location in this area followed by /andriod/sdk. To find the correct location open android studio>configure >Android sdk> copy the location
In SDK tools select most up to date platforms ( in Oct '16 it is 5.1 and 6.0) >install (it will take ages!)>reboot mac too
Open Appium press Doctor (stethoscope icon) confirm that all items are successfully installed as you will see a number of green ticks