You are here: User Guide > Nuke > Configuring Nuke > Setting Environment Variables

Setting Environment Variables

This section teaches you how to set environment variables, check if a particular environment variable exists, and display a list of set environment variables.

To Set an Environment Variable

On Windows

1.   Right-click on My Computer and select Properties.
2.   Go to the Advanced tab.
3.   Click the Environment Variables button. The Environment Variables dialog opens.
4.   Click the New button under either User variables or System variables, depending on whether you want to set the variable for the current user or all users. To set environment variables for all users, you need to have administrator privileges.
5.   In the Variable name field, enter the name of the environment variable you want to set. For a list of the environment variables that Nuke understands, see Nuke Environment Variables.
6.   In the Variable value field, enter the value for the variable. The value can be a directory path, for example.
7.   Click OK.

NOTE:  When editing existing system variables, or adding or deleting either user or system variables on Windows Vista, you need to log off and on again before your changes to environment variables take effect.

On Mac

On Mac OS X, there is a special environment file - a .plist or property list file - which is read every time a user logs in. You may need to create the .plist file if it doesn’t already exist in ~/.MacOSX/environment.plist (where "~" indicates the user’s home directory, and "." a hidden directory).

Environment variables set using the .plist file are read both when Nuke is launched from the Nuke icon and when it’s launched from the Terminal.

1.   Open a Terminal window. By default, you should be in your home directory (your own directory in the Users folder). Enter pwd (present working directory) to verify this.
2.   Enter ls -al to see a list of files in that directory. If .MacOSX is not in the list, enter mkdir .MacOSX to create the directory.
3.   To create your .plist file, launch TextEdit.
4.   Copy the following into the document and edit the “key” and “string” entries:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>NUKE_PATH</key>

<string>/SharedDisk/Nuke</string>

<key>OFX_PLUGIN_PATH</key>

<string>/SharedDisk/OFX</string>

</dict>

</plist>

This example sets two environment variables: NUKE_PATH and OFX_PLUGIN_PATH. NUKE_PATH points to /SharedDisk/Nuke/, and OFX_PLUGIN_PATH to /SharedDisk/OFX.

For a list of the environment variables that Nuke understands, see Nuke Environment Variables.

5.   Once you are happy with the document, select Format > Make Plain Text.
6.   Save the file to your home directory with the name environment.plist. Make sure a .txt extension is not added to the end of the file name.
7.   Quit TextEdit, and launch a Terminal window. Enter pwd to make sure you are in your home directory.
8.   To move the environment.plist file from your home directory into the .MacOSX directory, enter mv environment.plist .MacOSX.
9.   Log out and log in again.

On Linux

1.   The procedure for setting an environment variable depends on what your default shell is. To get the name of the shell you are using, launch a shell and enter echo $SHELL.
2.   Depending on the output of the previous step, do one of the following:

If your shell is a csh or tcsh shell, add the following command to the .cshrc or .tcshrc file in your home directory: setenv VARIABLE value. Replace VARIABLE with the name of the environment variable and value with the value you want to give it, for example setenv NUKE_PATH /SharedDisk/Nuke.

If your shell is a bash or ksh shell, add the following command to the .bashrc or .kshrc file in your home directory: export VARIABLE=value. Replace VARIABLE with the name of the environment variable and value with the value you want to give it, for example export NUKE_PATH=/SharedDisk/Nuke.

For a list of the environment variables that Nuke understands, see Nuke Environment Variables.

To Check if an Environment Variable Exists

On Windows

1.   Select Start > All Programs > Accessories > Command Prompt.
2.   In the command window that opens, enter echo %VARIABLE%. Replace VARIABLE with the name of the environment variable. For example, to check if NUKE_DISK_CACHE is set, enter echo %NUKE_DISK_CACHE%.

If the variable is set, its value is displayed in the command window.

On Mac or Linux

1.   Launch Terminal or a shell.
2.   Enter echo $VARIABLE. Replace VARIABLE with the name of the environment variable. For example, to check if NUKE_DISK_CACHE is set, enter echo $NUKE_DISK_CACHE.

If the variable is set, its value is displayed in the Terminal or shell window.

To Display a List of Set Environment Variables

On Windows

1.   Select Start > All Programs > Accessories > Command Prompt.
2.   In the command window that opens, enter set.

A list of all the environment variables that are set is displayed in the command window.

On Mac or Linux

1.   Launch Terminal or a shell.
2.   Enter printenv.

A list of all the environment variables that are set is displayed in the Terminal or shell window.