New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #24930 (new enhancement)

Opened 3 years ago

Last modified 8 months ago

Update PATH environment variable for all users

Reported by: sorin.sbarnea@… Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts Future
Component: base Version: 1.8.2
Keywords: Cc: 1handle@…, ryandesign@…
Port:

Description

The macports installer should update the PATH variable by itself, without requiring users to configure it. Configuring path variable by the average user is a complex task and removing this manual stop is an important step in promoting macports.

On OS X the proper way to modify PATH environment variable for all users, including root is to change /etc/paths file and add the new paths to it. The file contains the paths (each on separate line).

I tested this and it work at least with OS X 10.6

Change History

comment:1 Changed 3 years ago by toby@…

It does. (Or at least, it tries...)

comment:2 Changed 3 years ago by macsforever2000@…

  • Keywords installer removed
  • Component changed from ports to base
  • Milestone MacPorts 1.9.0 deleted

comment:3 Changed 3 years ago by ryandesign@…

During the development of MacPorts 1.8 (or 1.7? I forget) we experimented with using /etc/paths. This turn out not to be optimal for MacPorts because it appends the MacPorts path to the existing paths, instead of prepending it like we want. So we did not switch to that solution, and stayed with the auto-setup of the PATH variable in .profile that we've already had for awhile.

comment:4 Changed 3 years ago by jmr@…

This is going to get resolved "worksforme" unless you can provide steps to reproduce a failure by the installer to set up the PATH.

comment:5 follow-up: ↓ 7 Changed 3 years ago by sorin.sbarnea@…

when I installed latest release of MacPorts (10.8.2) on OSX 10.6 it did not update the path. Also please be aware that we expect to change the paths for all *users* not only current user, specially because on OSX most users are not using root account.

I think that appending to /etc/paths is a *good* and *safe* approach. I did not find any issues by having the macports paths to the end of the path.

Replacing OS utilities is risky and can break other OS components on OS X so using MacPorts too *add* missing utilities should be the default. If somebody really wants to replace them he can change the order. Also the installer could inform the user about this.

comment:6 Changed 3 years ago by jmr@…

  • Type changed from defect to enhancement
  • Summary changed from Update PATH environment variable from the installer to Update PATH environment variable for all users

comment:7 in reply to: ↑ 5 Changed 2 years ago by ryandesign@…

  • Cc 1handle@…, ryandesign@… added
  • Milestone set to MacPorts Future

Replying to sorin.sbarnea@…:

when I installed latest release of MacPorts (10.8.2) on OSX 10.6 it did not update the path.

It should have. If it did not, we need further information from you to be able to diagnose why.

Also please be aware that we expect to change the paths for all *users* not only current user, specially because on OSX most users are not using root account.

I'm afraid your expectations do not match how MacPorts currently works. We do currently only attempt to modify the profile of the currently-logged-in user. We do need to document this better, as explored further in duplicate #28882. Certainly we do not expect the user to be logged in as the root user; the root user is disabled by default on Mac OS X and there is probably no reason why a user should need to enable it. It might, however, be required that the user installing MacPorts is an administrator; I'm not sure.

I think that appending to /etc/paths is a *good* and *safe* approach. I did not find any issues by having the macports paths to the end of the path.

Replacing OS utilities is risky and can break other OS components on OS X so using MacPorts too *add* missing utilities should be the default. If somebody really wants to replace them he can change the order. Also the installer could inform the user about this.

We have no plans to change the fact that MacPorts prepends its prefix to the path. This is the expected behavior of most of our users.

comment:8 Changed 2 years ago by ryandesign@…

Half of #29708 is a duplicate of this.

comment:9 Changed 8 months ago by ryandesign@…

Part of #36323 is a duplicate of this.

Note: See TracTickets for help on using tickets.