New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #34841 (new enhancement)

Opened 11 months ago

Last modified 11 months ago

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: ports Version: 2.1.1
Keywords: $PATH, .bash_profile, rvm Cc:
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

comment:1 in reply to: ↑ description Changed 11 months ago by ryandesign@…

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.

Note: See TracTickets for help on using tickets.