Overview

This page will explain how to add or modify environment variables on different platforms. Environment variables consist of a name/value pair, written as NAME=VALUE.

Windows

Right-click My Computer (on the Desktop), and go Properties, Advanced, Environment Variables. Add or modify the value of the variables in the upper half of the property sheet that comes up ("user variables for ..."). If you are instructed to modify a variable, but it doesn't exist, go ahead and add it.

Some environment variable, such as PATH, already exist in the lower half of that property sheet. Ignore these - all variables discussed here are to be added/modified in the upper half of that sheet (unless you know better, in which case go for your life).

Some environment variables (e.g. PATH) list multiple values. In these variables, multiple values are separated by semi-colons and there should be no additional spaces. For instance,

PATH=C:\My Folder;C:\My Other Folder;

When you make changes, they will not be reflected in programs that are already open. You must, therefore, restart all programs in which you want to see these changes reflected - this includes Command Prompt, and any Launcher programs that lie behind Matlab or other applications. The surest way to restart all such programs is to restart your computer, but usually a log on/off cycle will be sufficient. To see which environment variables are set, and check you've done what you hoped, open a Command Prompt and execute "set".

Linux

Edit the file ~/.bashrc (~ represents your home directory), adding a line like the following to the bottom (notice the quotes).

export NAME='VALUE'

This will create (or overwrite) this environment variable whenever you open a bash prompt in future. Augment an existing variable using a line like the following.

export NAME=$NAME' MORE VALUES'

Some environment variables (e.g. PATH) list multiple values. In these variables, multiple values are separated by colons and there should be no additional spaces. For instance,

export PATH=/a/path:/another/path

export PATH=$PATH:more/paths

When you make changes, they will not be reflected in programs that are already open. You must, therefore, restart all programs in which you want to see these changes reflected - this includes bash, and any Launcher programs that lie behind Matlab or other applications. The surest way to restart all such programs is to restart your computer, but usually a log on/off cycle will be sufficient. To see which environment variables are set, and check you've done what you hoped, open a bash prompt and execute "env".

OSX

I don't know - do you?