Environment Variables in Mountain Lion

Hello there,

A few days back I posted an article about how to setup Environment Variables in MAC OSX Lion.
Yesterday, I updated to Mountain Lion and to my surprise, they changed the way you set them.

HERE is the original article that I posted.

After doing some research about the issue, I found this article. I’ve tried to do the changes in the ‘Maya.app’ adding the dictionary to ‘Info.plist’ but I can’t seem to be able to find it through the Python Interpreter within Maya.

Here is the syntax that I’m using:

import os
path = os.environ["MY_CUSTOM_PATH"]

Also, I’m a bit confused in regards of having environment variables within the application that you want to use.
Does that mean that we can’t have variables that can be accessed from different applications?

Do you have any ideas about how I can get this working? (Let me know if any of this doesn’t make any sense).
Thanks in advance,


I found a solution to the problem in this article.
Here are the steps necessary to setup Environment Variables in Mountain Lion:

[li] Open a Terminal Window.
[/li][li] Use the command ‘sudo nano /etc/launchd.conf’.
[/li][li] Enter your password.
[/li][li] Add the environment variables using the following syntax:

setenv NAME_OF_VARIABLE valueOfTheVariable

[li] Press ‘Ctrl + o’ to save the file
[/li][li] Press enter to accept the name of the file
[/li][li] Press ‘Ctrl + x’ to exit the editor.

You will need to restart your computer in order to get your Environment Variable working.

Hey thanks for your post.

I’ve gone through the way to set them up and it seems to have set it up in OSX cause I see:

GNU nano 2.0.6 File: /etc/launchd.conf’

setenv RIGGING_TOOL_ROOT /Volumes/1tbBay4/LY/RiggingTool

But my python plugin in is still not seeing the environment variables in Maya 2013.

Do we need to change some code in our python plugin as well? or do you think maybe I didn’t really set up my environment variables properly?

Does path = os.environ[“NAME_ROOT”] not work anymore either?

Any ideas?

Thanks a lot


You should be able to get all the Environment Variables that you set by using the following Python commands:

import os

If the variable RIGGING_TOOL_ROOT is not showing up, I think that it is because it’s not properly setup.

Looking at the code that you posted, it looks like you are setting up a variable named RIGGING_TOOL_ROOT but then trying to get NAME_ROOT (?)

You should be able to get the path to your tool by using the following code:

import os

Make sure that you restart your computer after setting up the Environment Variable.
Let me know how it goes.