Last active
December 29, 2024 08:20
-
-
Save zadr/e9a090fb564451fb5c76db233fabf0d0 to your computer and use it in GitHub Desktop.
MacPorts install without root privileges
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
The number of CPUs in my machine may differ from the number of CPUs in your machine
Allow N jobs at once; **infinite jobs** with no arg.
Isn't infinite jobs = no of cores at a time? Shouldn't need to specify the core
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
The number of CPUs in my machine may differ from the number of CPUs in your machine
in the years since this gist was written, Apple has changed default permissions of various directories. You can make a new directory and install to other locations (/opt, /Users/`whoami`/.usr, etc) as needed.