Opened 14 years ago

Last modified 12 years ago

#24930 new enhancement

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 (Ryan Carsten Schmidt)
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 (9)

comment:1 Changed 14 years ago by tobypeterson

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

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

Component: portsbase
Keywords: installer removed
Milestone: MacPorts 1.9.0

comment:3 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

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 14 years ago by jmroot (Joshua Root)

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 Changed 14 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 14 years ago by jmroot (Joshua Root)

Summary: Update PATH environment variable from the installerUpdate PATH environment variable for all users
Type: defectenhancement

comment:7 in reply to:  5 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: 1handle@… ryandesign@… added
Milestone: 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 13 years ago by ryandesign (Ryan Carsten Schmidt)

Half of #29708 is a duplicate of this.

comment:9 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Part of #36323 is a duplicate of this.

Note: See TracTickets for help on using tickets.