C.W.K.
Stream
Lesson 05 of 05 · published

MacPorts Wisdom

~10 min · macports, wisdom, gotchas

Level 0Newbie
0 XP0/55 lessons0/16 achievements
0/80 XP to next level80 XP to go0% complete

MacPorts rewards patience. The traps that hit Homebrew users (sudo damage, PATH pollution) hit MacPorts users differently — usually because of the source-build model and the strict prefix.

Always selfupdate first. Stale port trees install stale (sometimes vulnerable) software. Build the muscle memory: sudo port selfupdate is the first command of every MacPorts session.

Plan for build time. Homebrew's binary bottles install in seconds; MacPorts compiles. Heavy ports (gcc, llvm, qt5, perl modules with C extensions) take real time. If you need it now, install it now and walk away — don't tab over and start something else expecting it to be done in two minutes.

Don't mix MacPorts + Homebrew for the same package. They install to different prefixes, so coexistence is fine for different packages. But installing python via both creates two different pythons in your PATH and you'll spend an evening figuring out which one your scripts use.

Use port reclaim. MacPorts keeps source tarballs, build directories, and inactive port versions around. sudo port reclaim cleans the lot. Run it monthly.

Check port dependents before uninstalling. Removing a port that other ports depend on can break them. port dependents <name> shows you the blast radius before you commit.

Code

Pre-uninstall safety check·bash
# What relies on this port?
port dependents readline
# python312 depends on readline
# ipython depends on readline

# Now you know — uninstalling readline would break python312 and ipython.
# Don't do it without a plan.

External links

Exercise

If you have MacPorts installed: run 'sudo port reclaim' and note how much disk you free. If you don't have it installed: read the MacPorts Guide section on variants (https://guide.macports.org/#using.variants) and articulate, in your own words, what variants give you that Homebrew doesn't. The articulation is the lesson.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.