Robert Nicholas (email@example.com), Earth and Environmental Systems Institute, Penn State University
updated 9 November 2015
This document provides special instructions that explain how to download, build, install, and use
MacPorts if you don’t have
administrator privileges on the Mac you’re using. Because you’ll be customizing MacPorts for userspace operation, installation
procedure is somewhat different from the way you’d “normally” install MacPorts.
However, once installed, usage doesn’t change much, aside from the
fact that you’ll no longer need to use
sudo with the
port command. For general and much more comprehensive information
on MacPorts, see the MacPorts Guide at https://guide.macports.org/.
For this HOWTO, we’ll assume you’re using the most recent version of Mac OS X, which is version 10.10 (a.k.a. “Yosemite”) as of this writing. This procedure will probably work with previous versions of OS X but it hasn’t been tested.
First, make sure you have the XCode developer tools installed on your machine. You can find this on the Mac App Store; if you can’t install apps from the App Store, please ask your system administrator to install it for you. If you’re using one of SCRiM or PSU Meteorology Macs managed by Chuck Pavloski, this is already installed.
Open a Terminal window and type the following to download and unpack the MacPorts source:
mkdir ~/macports cd ~/macports curl -O https://distfiles.macports.org/MacPorts/MacPorts-2.3.4.tar.bz2 tar xf MacPorts-2.3.4.tar.bz2
As of this writing, the current version of MacPorts is version 2.3.4; check the MacPorts website to see if a newer version has been released and adjust the above accordingly.
Next, we build and install MacPorts:
cd MacPorts-2.3.4 PATH=/usr/bin:/usr/sbin:/bin:/sbin ./configure --enable-readline \ --prefix=$HOME/macports --with-no-root-privileges make make install
Use a text editor to add the following to the end of the BASH configuration file
export PATH=$HOME/macports/bin:$HOME/macports/sbin:$PATH export MANPATH=$HOME/macports/share/man:$MANPATH
This will ensure that your system can find MacPorts-related binaries and man pages.
To ensure MacPorts is properly installed, we first make sure BASH can find it. Open a new Terminal window and type:
You should get a result that looks like
/Users/<yourusername>/macports/bin/port. If you get an error or no output at all,
revisit the steps above or seek additional help.
Finally, we’ll try installing a simple package that has a relatively small number of dependencies.
port install htop
You should see several minutes of output documenting the download, compilation, and installation of
htop and its dependencies.
When this is complete (i.e. you have the BASH prompt back), type
htop to run the application (a nice, color enabled process
viewer that’s an alternative to the standard
q to quit it.
From this point forward, you should be able to use MacPorts as documented in the MacPorts Guide
(except that you won’t need to use
sudo since administrator privileges are not required).