DISQUS

Tech-Recipes: OS X: Change your PATH environment variable | Mac system administration | Tech-Recipes

  • david · 8 months ago
    I have a question: When I "echo $PATH" or type "env" which shows the same path I assume, I'm given a path that has a bunch of variables, namely /usr/bin/:/usr/bin/sbin, etc etc that I can't seem to find in my path files. Not in ~/.bashrc, ~/.profile, or anywhere else I've looked...where do those variables reside. I really just want to switch the order of /usr/bin and /usr/local/bin so my /usr/local/bin python2.6 install default starts instead of the version 2.5 that ships with Mac.

    Hope that's not too confusing, I don't think it is.

    Thanks for the otherwise helpful information...after adding a ~/.profile I noticed that the PATH in there precedes the other PATH attributes mentioned above so temporarily I've tacked /usr/local/bin on there and it works how I want...but now I have /usr/local/bin on the PATH twice and would like to remedy that.

    Cheers
  • tombeek · 7 months ago
    david: it's ok to have the same elements of a path variable in your path more than once; in some cases it is necessary. As far as how to give one path priority over another, just make the one you want to load come first (reading left to right) in your PATH variable.
  • marcel · 7 months ago
    normal i would add an exra PATH in /etc/profile
  • Mitch · 4 months ago
    Thanks mate,
    Just what I was looking for. It seemed to be a different way of doing things in Leopard than previous versions.
    Cheers,
    Mitch
  • Amgine · 1 month ago
    In my case, I need to add a directory to the path for both myself and for www-data. Is there a variation for adding the dir in /etc/profile?