Skip to main content

Featured post

MacPorts Brings the Best Open Source Software to Your Mac


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.
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. 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. 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 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.

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. 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:
  • Servers: Standard FOSS server stacks including AMP (Apache web server, MySQL/Maria database server, and PHP/Python), SSH, SAMBA, and and the BIND DNS server are available.
  • GNOME/KDE Software: If you’re a desktop Linux user, take your pick from among the 325 GNOME ports and 274 KDE ports. From GNOME’s GnuCash to KDE’s Amarok, you won’t miss anything. Other desktops including XFCE and NextStep are also represented.
  • Text Processing: If you’re coding, doing technical writing, or you just enjoy the zen-like experience that working in plain text offers, you’re covered. Text editors like the aforementioned Emacs and VIM are available for authoring, while applications and systems like Multimarkdown, DocBook, and LaTeX help publish it in a pretty format.
  • Programming Languages: Standards like Python, PHP, Ruby, and are all accounted for, as are newer or more specialized languages like CoffeeScript, Lua, and Kotlin. Other tools like development environments (e.g. Qt Creator for the Mac) and compilers (gcc) are present as well.

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). You’ll first need to install Xcode, which is a simple grab from the App Store.

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

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.

It comes as a PKG file, 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.


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) 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.

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!

Comments

Popular posts from this blog

Finding the Cheapest Car to Insure When Making a New Car Purchase

other lists of least expensive cars to insure do exist, in comparing the results above to those lists, the top 5 were already in this list, so this is a good guideline for the National Average expectation for cars costing less on insurance. Here are the other cars that made the list of vehicles that will save you money on insurance costs compared to the national average. All these cars cost between $1,204 and $1,221 per year according to the annual ranking of least expensive cars to insure. Mazda CX-3   Honda Pilot LX Fiat 500X Pop Nissan Frontier S Hyundai Tuscon SE Subaru (XV) Crosstrek 2.0l Honda HR-V LX Ford F-150 XL Ford Edge SE What Makes a Car Less Expensive for Insurance The information used to determine the cheapest cars to insure can often also be a good indicator to you of the cheapest cars to maintain and service. It can also be an indicator of potential problem areas because the insurance rates are determined when the insurance company...

Google Birthday Surprise Spinner: The Best Games And How To Play them

Google is celebrating its birthday in perhaps the most Google of ways: with a Doodle that lets you play through the most fun Doodles ever. The company is now 19 years old (or is it?) and so has a huge stock of entertaining and time-wasting little animations to play through. So it has selected the best of recent years and assembled them all into the meta-Doodle, which lets people use a spinner to find which of the Doodles to play. Using the Doodle is simple enough: you head to the Google homepage, click on the spinner, and opt either to play the option you've been given or have another go. But read on, because there's a major catch. In some cases, they're actually better than the times they were Google Doodles. That's because the company has made them full screen this time around, allowing you to see everything you're doing without all that bothersome Google branding getting in the way. For most people, picking through the games is an initially fu...