How To Edit Your PATH Environment Variables On Mac OS X

By Ben Hathaway on June 20, 2008 ·  

If you are new to Mac OS X, you may need to know how to edit your PATH. The good news is that this is an extremely easy task on Mac OS X.

Step 1: Open up a Terminal windows (this is in your Applications/Utilites folder by default)

Step 2: Enter the follow command:

$ sudo vi /etc/paths

This will open the paths file in vi (a simple command line file editor included on your system).

Step 3: Edit the contents of your PATH file by putting each path you want included on a separate line.

Step 4: Save the contents of your PATH file by pressing SHIFT + Z twice.

That’s it! Now you know how to edit the PATH on your Mac OS X computer system.

Post a comment

3 Responses to “How To Edit Your PATH Environment Variables On Mac OS X”

  1. Keir Briscoe

    I am able to open my path using the above command. But I am not able to add any lines or change any existing ones. What do I have to do to get into Edit mode?

  2. Ben Hathaway

    You can refer to vi editor commands for help with the specifics of using vi to edit files. To switch into edit mode though, you should be able to press “a” once and then ESC will get you out of edit mode. Then press “ZZ” to save the file.

  3. Keir Briscoe

    Thank you. I found that if I presses “i” I was able to insert a line of text.

    Unfortunately my python script will still not run.

    Thanks for your reply.

Leave your comments below.