Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gwhammett/3d025d015a57c11ccd43706694beb74c to your computer and use it in GitHub Desktop.
Save gwhammett/3d025d015a57c11ccd43706694beb74c to your computer and use it in GitHub Desktop.
Install MacPorts 2.5.3 without sudo / root privileges
# install
mkdir ~/macports
cd ~/macports
curl -O https://distfiles.macports.org/MacPorts/MacPorts-2.7.2.tar.bz2
tar xf MacPorts-2.7.2.tar.bz2
cd MacPorts-2.7.2
./configure --enable-readline --prefix=$HOME/macports --with-no-root-privileges
make && make install
# bash / zsh
echo "export MACPORTS_HOME=\$HOME/macports" >> ~/.bash_profile
echo "export PATH=\$MACPORTS_HOME/bin:\$MACPORTS_HOME/sbin" >> ~/.bash_profile
# fish
echo "set -gx MACPORTS_HOME \$HOME/macports" >> ~/.config/fish/config.fish
echo "set -gx PATH \$MACPORTS_HOME/bin \$MACPORTS_HOME/sbin" >> ~/.config/fish/config.fish
@gwhammett
Copy link
Author

gwhammett commented Sep 13, 2022

This will work for most people to install the main macports. However, one of the installation scripts tries to create a file or directory with a group name that is the same as my user name, and fails. I created a group with the same name as my user name, and added my user name to that group, and then the above macports install worked fine.

However, when I later tried to do "ports install gnuplot", it failed with the error messages:

--->  Installing cmake-bootstrap @3.9.6_0
Error: Failed to install cmake-bootstrap: MacPorts requires root privileges for this action
Error: See /Users/hammett/macports/var/macports/logs/_Users_hammett_macports_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_cmake-bootstrap/cmake-bootstrap/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port gnuplot failed

2022.10.12 update: I recommend using Homebrew to install gnuplot (and probably other things) on a Mac. Homebrew installs things under your own user name and not under root, and so doesn't require using sudo and it's elevated system privileges.

@gwhammett
Copy link
Author

If someone has time to reproduce this bug and report it to macports, that would be helpful. I have to do other things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment