Prevent MacPorts editing .bash_profile over and over again...

Ryan Schmidt ryandesign at
Wed Feb 1 06:38:03 UTC 2017

> On Jan 31, 2017, at 07:50, Bachsau wrote:
> Am 28.01.2017 um 17:31 schrieb Barry Scott:
>> I want to be able to stop MacPorts Installation from editing my .bash_profile.
>> As it happens I already set all the env var that are needed my self.
>> Is there a “do-not-edit-bash-profile” settings somewhere?
>> So far I have 3 sets of the settings in the same file.
>> Barry
> This is driving me mad as well. >:[[
> Whenever I install a new base using the pkg it changes my .bash_profile, even though I set all my paths in /etc/paths and am using MacPort's Bash as my default shell.

Sorry. Repeated modifications of the profile when the modifications were already there was a bug. It looks like a fix was committed, so hopefully 2.4.1 will not have this bug anymore.

Using /etc/paths to add the MacPorts paths is not recommended because that appends the MacPorts paths to the default, while we want the MacPorts paths to be prepended. We want MacPorts versions of software to supersede probably older versions provided by the OS, not vice versa as using /etc/paths will do.

> Nothing should change my .bash_profile without asking back. It is something that malware usually does.

The MacPorts installer has always done this. I'm pretty sure it tells you it will do this, and our documentation says so too. The alternative is that the user installs MacPorts, then when they try to use it they get an error that "port" could not be found in the path; this will cause tons of support requests that I would prefer to avoid, so I'd like to keep things the way they are, with the installer modifying the user's profile when needed.

More information about the macports-users mailing list