Mac OS 10.6, set environment variable

Hello everybody,

Main goal: make some custom path variable available permanently using some environment variable. For ant build, for example.

I got an issue to deploy Android environment with our big project on Apple Mac Mini, and I have found that it is not so easy as on Ubuntu to set an environment variable. To do that, you can follow support article.

In few words, you need to create:

1. Folder: .MacOSX inside your user directory;
2. File inside .MacOSX folder – environment.plist.

So file path will be: /Users/your_user/.MacOSX/environment.plist

Open this file using XCode.

To open this file using XCode – run XCode and choose ‘open other file’.

Problem starts when you understand that you have no XCode installed :)))

To solve this issue quickly, just open environment.plist file using nano editor (or using any other possible way: vi environment.plist or open environment.plist):

your_user: nano /Users/your_user/.MacOSX/environment.plist

in opened document, you can add following text:

“YOUR_VARIABLE” = “/Users/your_user/Documents/projects/Android/some_custom_sdk”;

Save file. Reboot Mac mini.

Now your environment will have persistent variable named YOUR_VARIABLE to check its value, open terminal and type echo $YOUR_VARIABLE

Happy configuring (:

Best regards,