Setting environment variables using Maya.env

There are two ways to set environment variables outside of Maya: using the standard operating system commands, or editing the Maya.env file. Using the Maya.env file is recommended so that you don’t clutter the standard environment settings with Maya-specific variables. You can also set up Maya.env as a roaming profile to be shared by many machines; this can be useful, for example, when you are performing distributed rendering among several Windows machines. See your networking documentation for details on setting up roaming profiles.

(All platforms) To set environment variables in a Maya.env file

  1. Create a text file named Maya.env.

    (Mac OS X) Maya.env is a text file that you can create and edit with any text editor. If you use TextEdit or a word processing program, be sure to save it as an ASCII (basic) text file, not RTF. (In the TextEdit Preferences window, set New Document Format to Plain text, and under Saving, turn off the option Append “.txt” to plain text files.)

    Because the .env extension is not recognized as a text file, you may need to open Maya.env from a word processing application instead of double-clicking the filename or icon.

  2. Save it to one of the following directories:
    • (Windows®)
      • drive:\Users\username\Documents\maya\version
    • (Mac OS X)
      • /Users/username/Library/Preferences/Autodesk/maya/version
      • /Users/username/Library/Preferences/Autodesk/maya
      Note: Do one of the following to open the Preferences directory using Mac OS X Lion:
      • Select Finder > Go > Go to Folder and type the directory path (/Users/username/Library/Preferences).
      • From the Terminal window, navigate to the Preferences directory and type open.
    • (Linux®)
      • ~/maya/version
      • ~/maya
        Note:
        • Make sure to capitalize Maya.env.
        • On Windows and Linux, you can change the location where Maya looks for Maya.env by setting the MAYA_APP_DIR environment variable using the operating system methods described below.
  3. Set each variable on a single line in the format:
    <NAME>=<value>
    
    • You can set any variable, including ones that you define yourself. The only variables you cannot set in Maya.env are MAYA_APP_DIR (all platforms), and HOME (Linux and Mac OS X) or USERPROFILE (Windows).
    • If you define your own variable, make sure it’s name does not contain spaces, tabs, or any of the following characters: / : * " < > |
    • You can use variable substitution by typing either $variable (Linux and Mac OS X) or %variable% (Windows). For example:

    Linux, Mac OS X:

    MAYA_PLUG_IN_PATH = $MAYA_APP_DIR/scripts/test
    

    Windows:

    MAYA_PLUG_IN_PATH = %MAYA_APP_DIR%\scripts\test
    
    • For directory paths use backslash (\) on Windows and forward slash (/) on Linux and Mac OS X.
    • To separate several paths, use a semicolon (;) on Windows and a colon (:) on Linux and Mac OS X.
    • Maya ignores blank lines and whitespace around the name, equal sign, and value. Lines that begin with # are considered comments and also ignored.

Examples

USER_SCRIPT_PATH = /Volumes/Sapphire/render/scenes/lego pov library/Library:/Volumes/Sapphire/render/scenes/maya/script:;
MAYA_SCRIPT_PATH = $USER_SCRIPT_PATH:$MAYA_SCRIPT_BASE/scripts/test:$MAYA_SCRIPT_BASE/scripts/unsupported
SHARED_MAYA_DIR = HostName:/usr/localhome/public/maya/2016.5
MAYA_SCRIPT_PATH = $SHARED_MAYA_DIR/scripts:$MAYA_APP_DIR/scripts/custom
MAYA_PLUG_IN_PATH = $SHARED_MAYA_DIR/plug-ins
TMPDIR = /disk2/tempspace
MAYA_SCRIPT_PATH = %MAYA_APP_DIR%\scripts\test
MAYA_PLUG_IN_PATH = %MAYA_LOCATION%\devkit\plug-ins;%MAYA_LOCATION%\devkit\test
TMPDIR = D:\tempspace
Note: Although we show platform-specific formatting for such things as path separators and variable markers above, Maya will understand the different formatting styles no matter which platform you are on.

We still recommend using the formatting conventions specific to your platform to avoid any possible errors (for example, copying and pasting paths between Maya.env and a shell).