I have blogged about installing brew package manager previously. Today I am going to show how to install MacPorts.
What is MacPorts?
MacPorts is an open source package manager for Mac OS X. It makes fetching, compiling and installing open source packages on Mac OS X easy.
It is recommended that you use only one package manager as there can be package conflicts. But I have been using MacPorts along with brew without any problems, unless you purposefully try to break the system.
Also MacPorts depends on Xcode and xcode command line tools. You can download these from App Store or from the Apple Developers website.
You can either download xcode command line tools from Apple Developer website itself or run the following command after install Xcode:
Installing MacPorts via Installer:
To install MacPorts (stable version), you can download the dmg from here.
Users having older version of Mac OS X can visit their Download page for detailed steps.
Installing MacPorts from source:
1) Clone the MacPorts source via svn (Subversion):
Run the following command in your Terminal.App:
svn checkout https://svn.macports.org/repository/macports/trunk macports-trunk
This will fetch the source of MacPorts into a folder named ‘macports-trunk’.
You can fetch the source in another folder by running in Terminal.App:
svn checkout https://svn.macports.org/repository/macports/trunk FOLDER_NAME
Note: Replace FOLDER_NAME with your desired folder name.
Considering that our MacPorts source is cloned in macports-trunk folder
If you have already cloned the source code then run the following code inside the macports-trunk directory (in Terminal.App):
Now to compile and install MacPorts, run the following sequence of commands in Terminal.App:
./configure --enable-readline make sudo make install
Run the following command to update your ports (MacPorts base sources)
sudo port -d selfupdate
You can use MacPorts (interactive mode of MacPorts) by running
To install a package using MacPorts you can run
sudo port install package_name
Hope this helps you installing open source packages on your Mac.
Let the Windows be open, and feel the Freedom.
One thought on “[How To]: Installing MacPorts on Mac OS X”