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

Daily MacPorts Commands

~12 min · macports, commands, workflow

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

The command name is port (singular). Almost everything that mutates the system needs sudo — that's the price of MacPorts' isolation model.

sudo port install <name> installs a port. Add +variant tokens after the name to enable build options, or -variant to disable defaults. port search <query> finds ports; add --description to search descriptions, not just names. port info <name> shows version, dependencies, available variants, and homepage.

sudo port selfupdate refreshes the port tree. sudo port upgrade outdated upgrades every outdated port — there's no Homebrew-style separation between "refresh definitions" and "install upgrades"; the order is selfupdate, then upgrade.

port installed shows everything you've installed. port installed active filters to only the active versions (MacPorts can keep multiple versions installed but only one active). sudo port uninstall inactive cleans up stale inactive versions. sudo port reclaim is the catch-all garbage collection — it removes orphaned dependencies, old source tarballs, and build directories.

Code

Install + customize with variants·bash
# Find available variants for a port BEFORE installing
port variants vim
# vim has variants: +python312, +lua, +cscope, -x11, ...

# Install with explicit variants (+ to enable, - to disable)
sudo port install vim +python312 +lua -x11

# Re-install with different variants later
sudo port uninstall vim
sudo port install vim +python312 +ruby
Find what's installed and what needs upgrading·bash
# Everything installed
port installed

# Only active versions
port installed active

# What's outdated
port outdated

# Why is THIS port installed (who depends on it)?
port dependents readline
Standard maintenance routine·bash
# The 'every two weeks' MacPorts hygiene routine
sudo port selfupdate
sudo port upgrade outdated
sudo port uninstall inactive
sudo port reclaim          # delete old build dirs and unused deps

External links

Exercise

Run 'port variants ffmpeg' (or any port you've installed) and read every variant. Variants are MacPorts' superpower — most users never explore them, then wonder why their tool is missing a feature. Pick one variant, reinstall the port with it enabled or disabled, and see the result.

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.