Skip to content

Instantly share code, notes, and snippets.

@zadr
Last active December 29, 2024 08:20
Show Gist options
  • Save zadr/e9a090fb564451fb5c76db233fabf0d0 to your computer and use it in GitHub Desktop.
Save zadr/e9a090fb564451fb5c76db233fabf0d0 to your computer and use it in GitHub Desktop.
MacPorts install without root privileges
# fetch MacPorts sources
curl -LO https://distfiles.macports.org/MacPorts/MacPorts-2.8.1.tar.gz
# extract them and get into the dir
tar -jxf MacPorts-2.8.1.tar.gz
cd MacPorts-2.8.1
# configure things
## If you want MacPorts to run in a custom prefix, pass in the following arguments: --prefix=/usr/local --with-unsupported-prefix --with-applications-dir=/Applications
## replacing /usr/local with your desired location
./configure --with-no-root-privileges --with-install-user=$USER --with-install-group=staff --silent
# build and install things, using however many performance CPUs are available
# for older versions of macOS, substitute in `machdep.cpu.core_count`
make -s -j `sysctl -n hw.perflevel0.physicalcpu`
make -s -j `sysctl -n hw.perflevel0.physicalcpu` install
# clean up after ourselves
cd ..
rm -rf MacPorts-2.8.1*
# post-install tasks
## Update ports to latest definitions
port selfupdate
## Edit the config to change any other values that you need, such as setting `buildfromsource` to `always`
### if you passed in a custom prefix via `--prefix`, replace /opt/local with your target prefix.
$EDITOR /opt/local/etc/macports/macports.conf
@zadr
Copy link
Author

zadr commented Oct 17, 2023

Isn't infinite jobs = no of cores at a time? Shouldn't need to specify the core

What are you hoping to get out of this thread? The gist we're talking on is a set of notes I wrote down for myself, and specifying the number of cores gives me the behavior I'm looking for.

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