How can I prevent macports from taking over my PATH?

1

1

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.

GameFreak

Posted 2009-10-06T12:12:01.227

Reputation: 184

Answers

8

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

hanleyp

Posted 2009-10-06T12:12:01.227

Reputation: 6 519

1My ~/.profle was modified by macports, there was even a comment in there telling me so. I commented out the PATH append in there and now my PATH is back to how it used to be. I'm on OSX 10.8 if it helps anyone. Thanks again hanleyp. – None – 2013-04-17T20:10:04.597

2

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}"

KeithB

Posted 2009-10-06T12:12:01.227

Reputation: 8 506

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 – 2009-10-06T14:29:46.040

asterisks for emphasizing the colons, naturally... – quack quixote – 2009-10-06T14:30:43.840

1Yes, you do. This is part of a larger script that adds the necessary colons to ${binpath} and ${sbinpath} – KeithB – 2009-10-07T11:56:39.433

1

I know it's been a while since the question was asked, but for the benefit of everyone else who finds this page:

On my system, Macports modified ~/.bash_login to insert its insidious $PATH modification command.

Al Onestone

Posted 2009-10-06T12:12:01.227

Reputation: 111