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.
{ 9 comments… read them below or add one }
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?
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.
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.
Thank you SO much! This worked perfectly! I would suggest for vi novices like myself it would be easier to use the pico editor like so “sudo pico /etc/paths”.
Many people suggest editing your .profile file but your solution looks much much better to me. Thank you for taking the time for sharing this.
Glad it helped. Editing the .profile is a good method if you are working in a multi-user environment because the .profile paths will only be loaded when you login. But if you want to make a global change for the system, the /etc/paths file will work better.
I am trying to change PATH Environment Variables On Mac OS X for CakePHP too
This information doesn’t cover the whole picture. There’s a good discussion here:
http://superuser.com/questions/69130/where-does-path-get-set-in-os-x-10-6-snow-leopard
In place of vi, use nano. It’s not so complicated.
{ 3 trackbacks }