2

What is the best way to permanently change the Mac OS X path variable? I've tried to add a .profile file in my user home directory with the below path, but that didn't work. Right now I have to run the export command every time I open up a new instance of the console. Any ideas?

export PATH=/Users/tom/sshfs-binaries:$PATH

4

If that's for a single user, you can add export PATH=/new/path:${PATH} to ~/.bash_profile. If it's going to be really global (for all users), then add it to /etc/profile and make sure the users have permission to access the path you're including. After that, you need to re-launch the shell, or reload the configurations with source /etc/profile or source ~/.bash_profile.

| improve this answer | |
  • how would I make it applicable for just one user? – c12 Nov 8 '11 at 19:19
  • @C12: put that export command on the /home/<user>/.bash_profile file. – jweyrich Nov 8 '11 at 19:34
  • I'm not the admin of this machine and I don't have a user directory in the /home/ dir. I also don't have a .bash_profile file under /Users/username. Any ideas? – user13463 Nov 9 '11 at 18:24
  • I suspect this happened before the question was migrated, but /home/<user>/.bash_profile is incorrect. On OS X it's /Users/<username>/.bash_profile So for example: /Users/c12/.bash_profile, just create the file if it doesn't exist and changes will be automatically picked up at next login / terminal invocation. – Jason Salaz Nov 9 '11 at 23:37
  • Oh, my bad. Jason is correct. When I wrote that comment I forgot the question was about OS X. – jweyrich Nov 10 '11 at 0:47
0

There's also ~/.MacOSX/environment.plist (also this and this).

"Note: Any changes to ~/.MacOSX/environment.plist require that you logout and login again for the change to take effect."

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .