Linux Mac

MacPorts Brings the Best Open Source Software to Your Mac

Aaron Peters 06-09-2017

It’s safe to say that the Apple ecosystem brought “app stores” to the mainstream. Before the introduction of the iPhone, buying digital software was often full of trials like submitting your payment to the developer’s website, waiting for a license key by email, and negotiating refunds.


You’d be forgiven for thinking that free and open source software (FOSS) is rare on the Mac, given Apple’s approach. In reality, the Mac is an excellent host for many of the community’s best free tools The Best Mac-Only Open Source Software When most people think open source, they think Linux. But Mac OS X has its share of quality open source programs as well — and a bunch of them aren't available for Linux or Windows. Read More .

MacPorts is your “app store” for all this great software. Let’s take a look at how it works.

What Is MacPorts?

MacPorts is a package system for Macs. It’s very similar in function and use to the Red Hat Package Management (RPM) system and Advanced Package Tools (APT), which install DEB packages on Linux How to Install Software on Linux: Package Formats Explained You've switched to Linux, and want to install some software. But package managers differ depending on your distro. So which apps can you download and install? It's all in the acronyms. Read More . Actually, it descends from the Ports system of FreeBSD.

Did you know Mac OS X started its life as a fork of FreeBSD called Darwin? Even today macOS has a solid UNIX-based foundation The 20-Year-Old Features Hidden In Your Mac Apple has been making computers and software for a long time, but El Capitan is totally modern —right? There's no way it includes any elements from the 90s. Read More . This makes it very easy for developers to create a “port” of free software applications that will run on Macs.

MacPorts is the collection of that software, as well as the application that acts as a “store” or installer. In the FreeBSD world, the ports system helps users compile software How to Compile Your Own Linux Kernel Compiling your own Linux kernel is one of those geeky, technical things, right? We've already covered a few reasons why you might want to do this -- now is the time to try it yourself! Read More from source:

  1. First, you fetch the ports collection, which is a huge number of configurations that describe applications and how to build them (including their dependencies). These are stored in your “/usr/ports” directory with a sub-directory for each port.
  2. Then you navigate to an application’s directory and issue to the “make install” command. The makefile literally builds the application from scratch: downloads the source code, compiles it, and configures it. The below image shows the contents of the port for KDE’s Amarok music player. You can even re-build the entire system from source with the “make world” command.

intro macports freebsd port

MacPorts follows this model. When you to select an application, the system will download it, compile it, and install it (again, including dependencies) on your Mac.

What Kind of Ports Are Available?

The MacPorts repository is full of all the same great open source applications you’ll find on Linux and related operating systems. If you’re familiar with Linux, there’s a good chance your favorite apps are among the 19,000+ available. Not only that, but they’re installed and maintained in a very Unix-like but still integrate nicely with macOS.

You’ll find some apps that are as good or better than commercial counterparts, such as the Emacs and VIM text editors Text Editors vs. IDEs: Which One Is Better For Programmers? Choosing between an advanced IDE and a simpler text editor can be hard. We offer some insight to help you make that decision. Read More . Others are arguably not as good but are still free.


If you’re looking for a particular program, try browsing at the link above or using the “port search” command (more on that later). Some of the software available includes:

Installing and Setting Up MacPorts

Since MacPorts will be compiling software on your machine, you’ll need some developers tools. Don’t worry, the app will do all the heavy lifting, so you won’t have to learn any nerd-speak (unless you want to, in which case start here 6 Easiest Programming Languages to Learn for Beginners Learning to program is about finding the right language just as much as it's about the edification process. Here are the top six easiest programming languages for beginners. Read More ). You’ll first need to install Xcode, which is a simple grab from the App Store.

intro macports xcode appstore

Next, open the Terminal app and run the following command, which will pop a dialog for you to download and install Xcode’s command line tools:

xcode-select --install

intro macports xcode command2

Getting the MacPorts front-end is as simple as downloading the app for your version of macOS (as shown in the below image) from the site’s install page.

macports app download

It comes as a PKG file This Is How Software Installers Work on Windows, macOS, and Linux Modern operating systems provide you with easy methods to set up new applications. But what actually happens when you run that installer or issue that command? Read More , so you’ll see the familiar wizard pop up to walk you through the install. You can click Continue through these screens, as there’s really no choices for you to make.


intro macports app install6

Once installed, you won’t see anything appear in the Applications folder like your average Mac program. The port search application is a command-line program, so you’ll need to fire up Terminal (or your favorite Mac-based terminal app Customize Your Mac Command Line With These Terminal Alternatives One of the best ways to make macOS your own is to customize the command line, either through alternative apps or just tricking out the Terminal app. Read More ) to get started.

The first thing to do is to update the collection of ports (which, again, are descriptions of available apps):

sudo port selfupdate

intro macports port selfupdate

Installing Your First Port

Once updated, you can start looking for applications to install. From the terminal, you can search for keywords with the port search command. Suppose we want to find an old-school dual-pane file manager. Similar items in the App Store are either commerical or have in-app purchases. Let’s try to find a free one with the following command:

port search 'file manager'

intro macports search filemanager

Picking through these results, you’ll find Krusader. This super-useful tool for Linux is indeed dual-pane, and adds extra functions like file synchronization and archive management. To install it, run the following:

sudo port install krusader

You’ll need to enter your admin password, since you’re running the “sudo” command. The install will take a while. (Note all the dependencies, upwards of 100, as shown in the below image.)

intro macports krusader install1

Before you run off and grab a coffee, take a moment to watch the automatic download and build of your app. It may seem like a lot of techno-babble filling up the terminal window (in fact, the output from these builds is blessedly compact). But if you look closely it’s easy to make out what’s happening for each port.

  1. First off, MacPorts determines in which order it should install the ports based on their dependencies.
  2. For the each one, MacPorts will download its source code archive from the server.
  3. It will also verify that it has the right one by comparing the archive’s checksum against the port description.
  4. Then, it unpacks the port’s source code.
  5. If there are configuration scripts to run before the build, those go next.
  6. Building the software involves compiling all the source code into something the Mac can execute.
  7. Once the build completes, the resulting executable code is placed in its proper directory, then registers the app with the system.
  8. Finally, MacPorts will clean up all the source code. These per-port steps are shown for Krusader in the below image.

intro macports krusader install3

Now you’ll find a new subfolder within Applications titled “MacPorts” containing your app (in this case, Krusader under the “KDE4” folder). Fire it up and stick it to the Dock, just like any other app. You can also launch it using Spotlight Search More Efficiently In Mac OS X With Our Top Spotlight Tips Spotlight has been a killer Mac feature for years, with Cupertino regularly schooling Redmond in the art of desktop search. Here are a few tips to help you find more on your Mac. Read More .

MacPorts Brings the Best Open Source Software to Your Mac intro macports krusader running 670x463

Updating and Deleting Your Ports

To update your ports collection, use the command we used at the very beginning (this will also update the MacPorts application itself):

sudo port selfupdate

Then you can list any out-of-date ports with this command:

port outdated

To actually execute the upgrade on these, use this:

sudo port upgrade

The upgrade subcommand will run through the same steps as install, except it will overwrite the older versions. If you tried out an app and want to delete of it, the uninstall subcommand will do the trick (Pallet, shown below, is a MacPorts GUI I installed which seems to be broken):

sudo port uninstall pallet

intro macports pallet uninstall

Get Your macOS Open Source Goodness With MacPorts

The MacPorts project unlocks many of the great things about open source software, including the community. You have full access to all the code, in a format that’s easy to install and maintain.

What do you think? Does the command line interface put you off? Which apps have you installed so far? Let us know your thoughts below in the comments!

Related topics: Mac App Store, Open Source, Terminal, Unix.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *