Opened 6 years ago

Closed 3 years ago

#58018 closed defect (invalid)

MacPorts fails to run after manual install via tarball

Reported by: dlo (Dan Loewenherz) Owned by:
Priority: Normal Milestone:
Component: base Version: 2.5.4
Keywords: Cc:
Port:

Description

Hi all. I used MacPorts a few years back and decided to play around with it today. Unfortunately I've run into a snag right after the install step.

(Side note: I would recommend explaining to more technical users why "sudo" is necessary for the default MacPorts installation as it remains unclear to me after a fair amount of searching around.)

I decided to install MacPorts in my home directory, under $HOME/macports.

My configure command:

./configure --with-no-root-privileges --prefix=$HOME/macports

I then ran:

make && make install

The last command seemed to run into a few failures, notably:

chmod -h 555 "/Users/dan/macports/bin/portf" "/Users/dan/macports/bin/port-tclsh"
chmod: invalid option -- 'h'
Try 'chmod --help' for more information.
make[2]: *** [install] Error 1
make[1]: *** [install] Error 1
make: *** [install] Error 1

Well, odd, I thought, but I didn't specify anything outside of the ordinary so figured that this must have been a false alarm. (After some digging, it turns out that coreutils / GNU chmod acts differently than the one bundled into macOS. May want to check for that in the configure step...).

Anywho, I then ran port install git to test things out and got this error message:

$ port install git
sources_conf must be set in /Users/dan/macports/etc/macports/macports.conf or in your /Users/dan/.macports/macports.conf file
    while executing
"mportinit ui_options global_options global_variations"
Error: /Users/dan/macports/bin/port: Failed to initialize MacPorts, sources_conf must be set in /Users/dan/macports/etc/macports/macports.conf or in your /Users/dan/.macports/macports.conf file

Change History (6)

comment:1 Changed 6 years ago by dlo (Dan Loewenherz)

Update: after removing coreutils chmod from my $PATH, the make install step still fails with the same error.

comment:2 in reply to:  description ; Changed 6 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to dlo:

(Side note: I would recommend explaining to more technical users why "sudo" is necessary for the default MacPorts installation as it remains unclear to me after a fair amount of searching around.)

I decided to install MacPorts in my home directory, under $HOME/macports.

My configure command:

./configure --with-no-root-privileges --prefix=$HOME/macports

Installing without root privileges is possible but is not recommended because it is less secure. When started with root privileges, MacPorts drops to an unprivileged "macports" user. Thus, MacPorts cannot affect your files and it cannot affect your operating system files (because the "macports" user does not have permission to do that) except at those very limited times when MacPorts must elevate itself back to root in order to install files. This is more secure than a non-root installation in which MacPorts has the ability to affect your user files at any time and a badly-written Portfile or build system could harm your files. In addition, with a non-root MacPorts installation, any rogue process on your machine could overwrite MacPorts-installed files without your knowledge; with a root MacPorts installation, that would not be possible without you providing your administrator password.

Configuring with a non-default prefix is possible but is not recommended because then you cannot benefit from our precompiled binaries and you will have to spend time compiling every port you want to install.

I agree that we should add this information to our documentation.

I then ran:

make && make install

The last command seemed to run into a few failures, notably:

chmod -h 555 "/Users/dan/macports/bin/portf" "/Users/dan/macports/bin/port-tclsh"
chmod: invalid option -- 'h'
Try 'chmod --help' for more information.
make[2]: *** [install] Error 1
make[1]: *** [install] Error 1
make: *** [install] Error 1

Well, odd, I thought, but I didn't specify anything outside of the ordinary so figured that this must have been a false alarm. (After some digging, it turns out that coreutils / GNU chmod acts differently than the one bundled into macOS. May want to check for that in the configure step...).

That's correct. I guess we expect you to be using BSD chmod, as provided by Apple with macOS. Placing GNU utilities before BSD utilities in your PATH is a sure way to break things on macOS, so don't do that.

Replying to dlo:

Update: after removing coreutils chmod from my $PATH, the make install step still fails with the same error.

Did you run make clean first, and rerun the ./configure step? If not, try that.

Anywho, I then ran port install git to test things out and got this error message:

$ port install git
sources_conf must be set in /Users/dan/macports/etc/macports/macports.conf or in your /Users/dan/.macports/macports.conf file
    while executing
"mportinit ui_options global_options global_variations"
Error: /Users/dan/macports/bin/port: Failed to initialize MacPorts, sources_conf must be set in /Users/dan/macports/etc/macports/macports.conf or in your /Users/dan/.macports/macports.conf file

The message is correct. sources_conf must be set in macports.conf. It is set there by default, so you either removed it or perhaps you have an ancient copy of macports.conf from a previous MacPorts installation from before the sources_conf option existed. Compare your macports.conf with our macports.conf.default and adopt all the changes that you can.

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

Component: portsbase

comment:4 in reply to:  2 Changed 6 years ago by jmroot (Joshua Root)

Replying to ryandesign:

The message is correct. sources_conf must be set in macports.conf. It is set there by default, so you either removed it or perhaps you have an ancient copy of macports.conf from a previous MacPorts installation from before the sources_conf option existed.

Or it doesn't exist because make install failed.

comment:5 in reply to:  2 Changed 6 years ago by dlo (Dan Loewenherz)

Replying to ryandesign:

Installing without root privileges is possible but is not recommended because it is less secure.

Even (especially?) to an experienced user, this feels confusing. Some documentation or explanation (even like the one here!) I think would allay a few questions from more experienced command-line users.

Replying to ryandesign:

Configuring with a non-default prefix is possible but is not recommended because then you cannot benefit from our precompiled binaries and you will have to spend time compiling every port you want to install.

Got it, yikes. Had no idea. Was wondering why building was so slow. :P

A warning when running the command may be a good thing to remind unwary users of this.

Replying to ryandesign:

I agree that we should add this information to our documentation.

Is this something that a newbie like me could, or should?, cut from here and paste into a patch?

Replying to ryandesign:

Well, odd, I thought, but I didn't specify anything outside of the ordinary so figured that this must have been a false alarm. (After some digging, it turns out that coreutils / GNU chmod acts differently than the one bundled into macOS. May want to check for that in the configure step...).

That's correct. I guess we expect you to be using BSD chmod, as provided by Apple with macOS. Placing GNU utilities before BSD utilities in your PATH is a sure way to break things on macOS, so don't do that.

😳

Replying to ryandesign:

Replying to dlo:

Update: after removing coreutils chmod from my $PATH, the make install step still fails with the same error.

Did you run make clean first, and rerun the ./configure step? If not, try that.

Nope. That was the issue (pretty sure, anyways).

Replying to jmroot:

Replying to ryandesign:

The message is correct. sources_conf must be set in macports.conf. It is set there by default, so you either removed it or perhaps you have an ancient copy of macports.conf from a previous MacPorts installation from before the sources_conf option existed.

Or it doesn't exist because make install failed.

Indeed, this was (is?) the problem.

comment:6 Changed 3 years ago by raimue (Rainer Müller)

Resolution: invalid
Status: newclosed

This problem was caused by having GNU coreutils in PATH, which is unsupported.

Note: See TracTickets for help on using tickets.