If you have to use sudo, that means the file's owner and permissions might not be set correctly. Use ls -a
to ensure that your .bashrc file is owned by the user of the home directory the .bashrc file sits in, and that the file has at least read-write permissions for this user (so that you can edit it without sudo, and so that bash can read it at startup).
If the .bashrc file isn't being read, there might be something blocking the shell from reading it at startup. Try adding a debugging print statement at the top of the .bashrc file, like echo hello from the beginning
. See if this shows up.
echo $HOME
whoami
groups
-- first group listed should be the user's main group.
I recommend spending some time learning how to use a Unix system instead of immediately trying to set up Appium. You'll find a lot of tutorials online that pertain to Linux, but many of the concepts presented will equally apply to OS X.
Another good thing to check is to make sure you are running Bash. Try echo $SHELL
to make sure that the shell is Bash. On my systems, this prints "/bin/bash".
Also, what does your .bash_profile file say? (I'm redacting my previous statement about Bash not reading .bash_profile). Try adding some echo commands inside that file to check if Bash actually is reading from that file.
If you type man bash
, you'll see the manual for Bash. You can navigate up and down the using the 'j' and 'k' keys on your keyboard. You can close the manual by pressing 'q'.
/bin/sh is a historical version of a shell. Bash is similar to sh, but it has some additional features. If you see /bin/sh, that means you're running this historical version of sh rather than Bash (or you might be running Bash, but it's behaving like sh, but this is besides the point - you're effectively running with an sh-like environment). /bin/sh does not read .bash_profile nor does it read .bashrc, so the variables you want set are never actually set.
One workaround is to rename .bash_profile to .profile. .profile is a special file that will be read by both /bin/sh and bash, so in either case you'll have somewhere that gets read. You'd have to move the contents in .bashrc into .profile, however.
Another solution is to change your default shell from /bin/sh to bash. I'm not too clear on how it's done on OS X (Linux systems store this information in /etc/passwd), but you can change the default shell in the terminal application by looking under its Preferences; the default shell should be settable under the General tab.
As another solution, I have a special line in my .profile that looks like the following:
if [ -f "$HOME/.bashrc" ]; then
source "$HOME/.bashrc"
fi
With this, I ensure that my settings in .bashrc will always be read whether I login or when I launch a new shell. I actually have most of my environment variables set inside my .profile file, though, since this file is read only once, and the variables are inherited throughout all my processes.
Sure. One thing to add to my previous post: I looked up how shells were changed on OS X, and the convenient command is the same as it is for Linux systems: the chsh command. It would be handy to keep this in mind in the future for anyone who runs into issues where the default shell is not what they expect.
The $SHELL variable represents your default shell. So far, the Terminal application will run bash, but bash is not your default.9 I think you'll need to use chsh to change your default.
I don't have any recommendations for tutorials, but searching the web for a tutorial will be a good start. Here's one such result: http://www.ee.surrey.ac.uk/Teaching/Unix/index.html14
Please Open the Bash file and then add according to your mac installation as shown below and then try to use appium doctor for the confirmation.
export ANDROID_HOME=/Users/XXXXX/Library/Android/sdk
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
export PATH=${PATH}$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$JAVA_HOME/bin