Share
 
 

Setting environment variables using Maya.env

The Maya.env file is used to set environment variables.

With the exception of a few specific environment variables, values of variables set in Maya.env will not override the values set in your operating system environment. This means that if you have set a variable such as PYTHONPATH in your system environment, setting it in Maya.env will have no effect, and the value of PYTHONPATH as set in your environment will be used by Maya.

If a variable is not set in your environment, its value in Maya.env will be used by Maya.

The variables that are overridden by Maya.env even if they are set in your system environment are:

  • MAYA_SCRIPT_BASE
  • MAYA_SHADER_LIBRARY_PATH
  • MAYA_LOCATION
  • MAYA_HELP_URL
  • MAYA_PLUG_IN_PATH
  • MAYA_PLUG_IN_RESOURCE_PATH
  • MAYA_SCRIPT_PATH
  • XBMLANGPATH
  • MAYA_MODULE_PATH
  • MAYA_CONTENT_PATH
  • PATH
  • SYNHUB_CONFIG_PATH

There is one Maya.env file per version of Maya. You can find it in:

Platform Location of Maya.env
Windows C:\Users\<Username>\Documents\maya\<version_number>\
macOS $HOME/Library/Preferences/Autodesk/maya/<version_number>/

The Maya.env file will generally be created after the first time you start Maya. If it is not there, you can create it yourself.

To edit Maya.env, open it in a text editor, and enter each environment variable and value pair on its own line:
<ENVIRONMENT_VARIABLE>=<value>

You cannot set MAYA_APP_DIR in Maya.env.

Maya ignores blank lines and whitespace around the name, equal sign, and value. Lines that begin with # are considered comments and ignored.

Separate multiple paths with a semicolon (;) on Windows, or a colon (:) on macOS.

You can use variable substitution in Maya.env. Use $[variable_name] on macOS, and %[variable_name]% on Windows. Any environment variable, even if it is not specific to Maya, can be used in a substitution provided it is already defined. For example:
On macOS MAYA_PLUG_IN_PATH = $MAYA_APP_DIR/scripts/test
On Windows MAYA_PLUG_IN_PATH = %MAYA_APP_DIR%\scripts\test

Maya.env search path

Maya first checks if the MAYA_ENV_DIR environment variable is set. If so, Maya.env is read from this location.

If this environment variable is not set (default behavior), Maya then searches for Maya.env in the following order:

  1. MAYA_APP_DIR/<MayaVersion>
  2. MAYA_APP_DIR
Tip: To query the location of your MAYA_APP_DIR, type the following in the command line:
getenv "MAYA_APP_DIR"

Was this information helpful?