How can I prevent macports from taking over my PATH? I still want to have the installed software show up, but I want things in the standard system paths (/bin, /sbin, /usr/bin, ...) to have precedence over anything that macports installs.

link|improve this question
You might consider accepting an answer so that people can get points … – Nerdling Oct 21 '09 at 13:18
feedback

2 Answers

MacPorts Installer automatically modifies the environment so that MacPorts commands are called before system commands in its Postflight Script. You can type env in the terminal to see what your PATH is currently. If your ~/.profile was modified, you can manually change it back from:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

to

export PATH=$PATH:/opt/local/bin:/opt/local/sbin

You must restart the terminal for this to take effect.

If this isn't the problem, check the environment.plist with the Property List Editor:

~/.MacOSX/environment.plist
link|improve this answer
feedback

You probably have line in your .bashrc or .profile that sources /opt/local/share/macports/setupenv.bash

You will have to remove that and setup your PATH (and MAN_PATH) yourself. You can use the macports file as a guide, just switch

export PATH="${binpath}${sbinpath}${PATH}"

to

export PATH="${PATH}${binpath}${sbinpath}"

link|improve this answer
i don't have a Mac so maybe it's different, but don't you need separators between the variables in your export statements? eg "export PATH=${PATH}**:**${binpath}**:**${sbinpath}" – quack quixote Oct 6 '09 at 14:29
asterisks for emphasizing the colons, naturally... – quack quixote Oct 6 '09 at 14:30
1  
Yes, you do. This is part of a larger script that adds the necessary colons to ${binpath} and ${sbinpath} – KeithB Oct 7 '09 at 11:56
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.