Here we will talk about some things you’ll need for setting environment variables in Mac OS X.

Terminal

You will find Terminal in the Utilities folder in the Applications folder.

Print all environment variables:

Terminal - hostname:~ user$

1
set

Output

1
2
3
4
BASH=/bin/bash
.
.
.

Print a specific environment variable:

Terminal - hostname:~ user$

1
echo $HOME

Output

1
/Users/user

Text Editors

Depending on which method you pick, you’ll need to edit some text files

GUI

TextWrangler

If you pick TextWrangler, we’ll be opening files with File > Open File by Name...

Xcode

If you pick Xcode, we’ll be opening files with File > Open Quickly....

If you use the ~/.MacOSX/environment.plist approach, you’ll need Xcode for editing plist files.

In Terminal

The following editors are already installed.

  • vi/vim
  • pico/nano
  • emacs

You will need to use sudo for open some files, notably in /etc.

Example:

Terminal - hostname:~ user$

1
sudo vim /etc/profile

Parts of this series