Posted on by & filed under Content - Highlights and Reviews, Programming & Development.

codeA guest post by Shannon Appelcline, a versatile author and programmer who currently works as the lead iOS developer for Skotos Tech, an online entertainment company. In the past two years, he’s written seven iOS games for them, all based on tabletop releases by popular German designers. The first of these was Reiner Knizia’s Money (2010)—which has also been ported to MacOS—while the most recent was Reiner Knizia’s Modern Art: The Card Game (2011). Shannon’s two most recent books show the breadth of his interests. They are iOS4 in Action (2011), published by Manning Publications, and Designers & Dragons: A History of the Roleplaying Game Industry (2011), published by Mongoose Publishing.

In Getting Started with Homebrew, I talked about what the Homebrew package management system is, why you’d want to use it, and how to install it and access its basic functionality.

This post expands upon those basic ideas by talking about how to keep your Homebrew up to date — and so ensure it’s doing its job optimally.

Tip #1: Update Your Homebrew

You want to always ensure that you’re running the newest version of Homebrew and that it has the newest list of formulae available from the main repository. This is done with the “brew update” command:

Tip #2: Know What You Have Installed

The problem with a package management tool is that it can cause app-creep, as new and wonderful software gets downloaded to your Mac, and then never gets used again. So, every once in a while you should type “brew list,” which will show everything installed on your machine with Homebrew:

As usual, you can then use “brew info [package]” to get more info on an individual package:

Tip #3: Uninstall Unused Software

If you find software that’s outdated, it’s easy to get rid of it. You just “brew uninstall [package]” and the software disappears:

Unfortunately, uninstalling a package will not uninstall its dependencies, so you’ll need to do that by hand, one package at a time.
Be sure that you’re not uninstalling something used by another package, as Homebrew won’t protect you from doing so.

Tip #4: Check Your Used Software

One of the coolest elements of package management software is that you can use it to constantly keep your installed software up-to-date. There’s no remembering where you grabbed software from and then hunting down updates. Instead, you can automatically update everything with just a few commands.
It’s safest to start out by seeing what’s out-of-date. You want to “brew update” first to make sure your listings are up-to-date, and then you can “brew outdated”.

This command is purely information; it’ll just show you what could be updated.

Tip #5: Update Your Out-of-date Software

Once you’ve seen what’s out-of-date, you can then update everything that was installed by Homebrew with a simple “brew upgrade” command:

You may not want to upgrade certain packages, however, because they’re too important or because you need to keep using an older version of the software. In this case, you should protect the older software by “pinning” it, so that it won’t be upgraded. The following command would keep MySQL at its current version:

You can then run “brew upgrade” and everything but your pinned packages will be updated. At some point in the future you can choose to “brew unpin [package]” to unprotect the package in question.

If you prefer to instead only upgrade specific packages, you can do that by using the “brew upgrade” command selectively on packages that are outdated. The following command would only upgrade the wget package:

Tip #6: Take Control By Tapping Other Repositories

The above tips all presume that you’re in sync with Homebrew’s master repository. However, sometimes you may want to access other repositories that include other packages. This is done with the “brew tap” command.
You can find a list of interesting brew taps here: https://github.com/Homebrew/homebrew/wiki/Interesting-Taps-&-Branches.

If you want to access a tap, you can do so like this:

You can then install directly from the new tap with the “brew install [package]” function.
You’ll probably want to keep your brew taps up to date too, so that you don’t inadvertently install things from taps that are old and out-of-date. You can always use “brew tap” to see the current list of taps that you’re accessing. You can choose to “unsubscribe” from a tap with the “brew untap” command:

Conclusion

Watch for another article on Homebrew, which will talk about great packages for developers and how to use Homebrew with various popular programming languages.

Look below for some great Mac OS X and Homebrew resources from Safari Books Online.

Not a subscriber? Sign up for a free trial.

Safari Books Online has the content you need

Macintosh Terminal Pocket Guide will help you learn commands for a variety of tasks, such as killing programs that refuse to quit, renaming a large batch of files in seconds, or running jobs in the background while you do other work. Get started with an easy-to-understand overview of the Terminal and its partner, the shell. Then dive into commands neatly arranged into two dozen categories, including directory operations, file comparisons, and network connections.
Mac Hacks helps you dig below the surface to tweak system preferences, mount drives and devices, and generally do things with your system that Apple doesn’t expect you to do. With a little effort, you can make your Mac and its applications perform exactly the way you want them to.
OS X Mavericks: The Missing Manual shows you what you get when you cross a Mac with an iPad — OS X 10.9 Mavericks. Its 200 new features include Mac versions of iPad goodies like Maps, iBooks, and iTunes Radio—but not a single page of instructions. Fortunately, David Pogue is back, with the expertise and humor that have made this the #1 bestselling Mac book for over 11 years straight.

Tags: brew, Homebrew, package management system, repositories,

Comments are closed.