Monday, 2 April 2012

Mac OS X - Package Management with MacPorts

MacPorts
The MacPorts Project is an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac OS X operating system.

You can obtain MacPorts from the download page as a package (For Lion, Snow Leopard and Leopard - At time of writing) or you can build from source.
This will typically be installed into /opt/local/bin, so make sure this sits in your PATH.

Update MacPorts
Code Snippet
  1. port selfupdate
End of Code Snippet

View installed ports
Code Snippet
  1. port installed
End of Code Snippet

Search for ports
Code Snippet
  1. port search apache2
End of Code Snippet

Get information about a port
Code Snippet
  1. port info apache2
End of Code Snippet

Find out dependencies for a port
Code Snippet
  1. port deps apache2
End of Code Snippet

See what variations for a port are available (I.e. with/without SSL)
Code Snippet
  1. port variants apache2
End of Code Snippet

Install a port (-f = Force activation)
Code Snippet
  1. sudo port install -f apache2
End of Code Snippet

Clean an installed port
Code Snippet
  1. sudo port clean --all apache2
End of Code Snippet

Uninstall a port
Code Snippet
  1. sudo port uninstall apache2
End of Code Snippet

Display files belonging to an installed port
Code Snippet
  1. port contents apache2
End of Code Snippet

Upgrade a port
Code Snippet
  1. sudo port upgrade apache2
End of Code Snippet


More information can be found on the official MacPorts Guide.

No comments: