There are two primary methods for setting environment variables outside of Maya: utilizing standard operating system commands or modifying the Maya.env file. The Maya.env file method is generally preferred to prevent cluttering your core system environment settings with Maya-specific variables. Furthermore, setting up Maya.env as a roaming profile enables sharing across various machines, which is particularly useful for distributed rendering across multiple Windows systems. Consult your networking documentation for details regarding roaming profile configuration.
(All platforms) Setting Environment Variables in a Maya.env File
- Create a text file named Maya.env. (Mac OS X) Maya.env is a text file that you can create and edit using any text editor. If you utilize TextEdit or a word processing program, ensure you 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, disable the option Append “.txt” to plain text files.) Because the .env extension isn’t recognized as a text file, you might need to open Maya.env from a word processing application instead of double-clicking the filename or icon.
- Save it to one of the following directories:
- (Windows®)
- drive:UsersusernameDocumentsmayaversion
- (Mac OS X)
- /Users/username/Library/Preferences/Autodesk/maya/version
- /Users/username/Library/Preferences/Autodesk/maya
Note:
- 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
- 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.
- (Windows®)
- 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 its 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%scriptstest- 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
- This example uses Mac OS X-specific formatting and typical folders.
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
- The following example shows how you can define your own variable (SHARED_MAYA_DIR) and use it to set the value of other Maya variables.
SHARED_MAYA_DIR = HostName:/usr/localhome/public/maya/<version> MAYA_SCRIPT_PATH = $SHARED_MAYA_DIR/scripts:$MAYA_APP_DIR/scripts/custom MAYA_PLUG_IN_PATH = $SHARED_MAYA_DIR/plug-ins TMPDIR = /disk2/tempspace
- This example is the same as Linux, but with Windows-specific formatting.
MAYA_SCRIPT_PATH = %MAYA_APP_DIR%scriptstest MAYA_PLUG_IN_PATH = %MAYA_LOCATION%devkitplug-ins;%MAYA_LOCATION%devkittest 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 adhering to the formatting conventions specific to your platform to avoid potential errors (for example, when copying and pasting paths between Maya.env and a shell).
See also:
- All my renders appear black or blank on Maya ?
- Unable to open a file previously working in Maya
Source: Autodesk