Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How do I add a new environment variable for my mac? I want to add ANDROID_HOME as my environmentvariable.

How do I add a new environment variable for my mac? I want to add ANDROID_HOME as my environment variable.

MacBook Pro, OS X Yosemite (10.10.3)

Posted on Aug 29, 2015 2:52 PM

Reply
4 replies

Aug 30, 2015 7:59 AM in response to soumyaranjan789

Tony T1's query will get you many examples of the following. (Though it's not via launchctl.)


Specifically for this case, launch Terminal.app and navigate to your .bash_profile file or whatever login you're using locally, edit via vim or emacs or nano, and add something akin to the following line:


export ANDROID_HOME='/Users/soumyaranjan789/Documents/android/sdk'


Or whatever the path to your SDK might be.


Here's a specific StackOverflow write-up with rather more details.

Aug 31, 2015 6:10 AM in response to soumyaranjan789

Assuming that you've logged out and back in again and that the environment variable is (then, still) not working... If you have not logged out and back in (or minimally started a fresh tab or session, start there. If you have logged out or restarted a tab and the variable is not present, then see this description of the login processing and see the OS X-specific answer here both for some background (.bash_profile, .bashrc, et al) and for how OS X and Terminal.app works, and see man bash for how it's supposed to work — Terminal.app doesn't necessarily always do what might be expected from the generic descriptions and other distros, if that's not clear.

Also make sure you're using the right quoting characters, as bash uses back ticks and apostrophes, and the smart quotes settings on OS X can play havoc with that usage. (Various discussions of this around the 'net, such as here.)

How do I add a new environment variable for my mac? I want to add ANDROID_HOME as my environmentvariable.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.