Create a ticket
Follow

Q100015: How To Set Environment Variables

SUMMARY

This article explains how to set environment variables for supported versions of Windows, Mac and Linux.
 
Please note that recent changes made in OSX El Capitan have broken compatibility with how to set an environment variable on Mac.

 
WINDOWS 10

  1. Type "env" in the Taskbar Search,
    and select Edit the system environment variablesScreen_Shot_2021-12-06_at_5.06.15_PM.png

  2. Click the Environment Variables... button.
    Screen_Shot_2021-12-06_at_5.08.39_PM.png

  3. Click New to create a new environment variable
    or click Edit to modify an existing environment variable
    Screen_Shot_2021-12-06_at_5.17.04_PM.png
    Info: Depending on whether you want to set the variable for the current user or all users, use the buttons in User variables or in System variables section, respectively. Setting environment variables for all users requires administrator privileges.

  4. In the Variable name field, enter the name of the environment variable you want to set.

  5. In the Variable value field, enter the value for the variable. The value can be a directory path, for example.
    Screen_Shot_2021-12-06_at_5.29.45_PM.png

  6. Click OK to have the change take effect.
    Close all remaining windows by clicking OK.

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

OS X

On Mac OS X, you can use the launchd.conf file to set environment variables. You may need to create the launchd.conf file if it doesn’t already exist in the /etc/ directory.1) Open a Terminal window.2) Create the /etc/launchd.conf file, if it doesn't already exist, and then add the environment variable(s) and value(s) to the file using the following format:

 
setenv <VARIABLE> <VALUE>

For example, to set two environment variables, NUKE_PATH and OFX_PLUGIN_PATH, to point to alternate location:
 
setenv NUKE_PATH /SharedDisk/Nuke
setenv OFX_PLUGIN_PATH /SharedDisk/OFX
  
For a list of the environment variables that Nuke understands, see Nuke Environment Variables.

TIP: A handy command line tool for creating and editing files in the Terminal is nano. To start nano with the correct permissions, enter:
 
sudo nano /etc/launchd.conf
 
3) To force the OS to read the launchd.conf file at startup, enter:
 
launchctl < /etc/launchd.conf; sudo launchctl < /etc/launchd.conf

4) Restart your Mac to apply the changes.
  

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, open a Terminal window 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.

 



Keywords: Environment variables, Nuke
Was this article helpful?

We're sorry to hear that

Please tell us why
4 out of 9 found this helpful