Opened 9 years ago

Last modified 12 months ago

#34841 new enhancement

Each MacPorts install adds a $PATH variable even if it already exists; Also, puts it after rvm $PATH variable

Reported by: lawrence.trey@… Owned by: macports-tickets@…
Priority: Low Milestone: MacPorts Future
Component: base Version: 2.1.1
Keywords: Cc: jul_bsd@…, larryv (Lawrence Velázquez), mkae (Marko Käning), 1-61803
Port:

Description

Even if the $PATH variable exists for a previous install, MacPorts adds another. This won't cause any issues, but it will clutter the ~/.bash_profile script.

Also, the $PATH variable is appended to the ~/.bash_profile script. This means that if rvm has been installed, the default rvm ruby version is overridden by the $PATH variable for MacPorts. So for each new bash session, the native ruby is loaded instead of the default rvm ruby version. There should be some logic to check to see if rvm is being used, and if so, the MacPorts $PATH variable should be added before rvm is loaded.

Change History (3)

comment:1 in reply to:  description Changed 9 years ago by ryandesign (Ryan Schmidt)

Replying to lawrence.trey@…:

Even if the $PATH variable exists for a previous install, MacPorts adds another. This won't cause any issues, but it will clutter the ~/.bash_profile script.

That's not supposed to happen. The code only adds the MacPorts path to PATH if it's not already in there. If that's not what you see, then we need your help to diagnose why that might be.

Also, the $PATH variable is appended to the ~/.bash_profile script.

Yes, our intention is that, no matter what paths the user may have set up earlier in their profile, we want our path prepended. This ensures that MacPorts versions get used instead of system versions.

This means that if rvm has been installed, the default rvm ruby version is overridden by the $PATH variable for MacPorts. So for each new bash session, the native ruby is loaded instead of the default rvm ruby version. There should be some logic to check to see if rvm is being used, and if so, the MacPorts $PATH variable should be added before rvm is loaded.

I'm unclear on why it would be MacPorts' responsibility to know anything about rvm or any other program wanting to modify your shell environment. Ultimately, it's the responsibility of the user to set up their profile in a way that suits their needs. MacPorts only does a one-time change of the user's profile at the time that you originally install MacPorts using the package installer, as a convenience to the user, but the user is free to change that.

comment:2 Changed 5 years ago by mf2k (Frank Schima)

Component: portsbase
Keywords: $PATH .bash_profile rvm removed
Milestone: MacPorts Future

I'm not sure if this is true anymore.

comment:3 Changed 12 months ago by ryandesign (Ryan Schmidt)

Cc: jul_bsd@… larryv mkae 1-61803 added
Milestone: MacPorts Future

Has duplicate #43749 which contains some more discussion including that r154110 may have fixed some of the problem.

Note: See TracTickets for help on using tickets.