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

codeShannon Appelcline is 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.
Previous posts talked about how to set up Homebrew on your MacOS X system, and how to keep it up to date. If you’ve followed that advice (or if you’ve previously used Homebrew), then you should have a package management system ready to go on your MacOS X system.

But, what do you do with it now? And how do you use it to improve your development work? Follow along to find out.

Finding Packages

The previous articles covered the major ways to find Homebrew packages. In order to locate packages in Homebrew’s main repository, you can use the “brew search” command or one of two web sites:

You can add additional repositories of packages with the “brew tap” command. A good list of them can also be found here.

What follows are some of the most interesting packages (and taps) for developers of all sorts.

Great Command Line Tools

Homebrew features many command line utilities originally developed for UNIX (and now available for MacOS X). Developers may find Lynx particularly helpful. Lynx is a command-line web browser that makes it quick and easy to check out the bare bones of web pages, even when you’re not sitting at a graphical workstation:

Memcached is another utility. It is a high-performance memory-caching system that works with dynamic web pages. You may already be familiar with its use in the programming language of your choice. If your Mac is a production server, then you’ll probably want to install it:

If you’re building a dynamic web page on a MacOS X server, you probably want to use a database as a back-end. MySQL is a great lightweight database that’s heavily documented and supported on the net:

You may also want to explore related packages like automysqlbackup (which automates MySQL backups), mysql++ (which provides a wrapper for use with C++), and mysqlreport (which offers reporting functionality on your MySQL server).

Not every Homebrew package has to directly affect your web production or development. You may also want to install software that makes your command line environment more pleasant. ZSH is a great example of this sort of package. It’s an alternative shell for the Terminal that includes a powerful scripting language and great features from many other shells like BASH, KSH, and TCSH:

And that’s a quick summary of Homebrew packages that might be of use to any developer. We’re now ready to dive into some specifics for programmers of PHP, Python, and Ruby.

PHP & Homebrew

If you’re a PHP developer, you can make your life easier with Homebrew by accessing the official PHP tap:

This can permit you to do two different things. First, you can install a different version of PHP if needed. MacOS X Mavericks currently comes with PHP 5.4.24, but if you instead want to test on PHP 5.2, 5.3, 5.5, or 5.6, they’re all available:

Be warned, you’ll be installing a new version of PHP that could conflict with the one installed by Apple, so do this at your own risk.

You can also use Homebrew to install specific PHP packages appropriate for whatever PHP version you’re running, including libraries for imagick, memcache, yaml, and lots more. Once you’ve tapped the PHP repository, search for your preferred version of PHP.

01c-01-PHP-Search

As you can see, there’s a huge array of material available.

Python & Homebrew

As of MacOS X Mavericks, Python 2.7 is installed as part of the MacOS X operating system. However, you may want to use Homebrew to install a more fully featured and up-to-date version of Python 2.7.X or to even Python 3.X. They’re both available as part of Homebrew’s standard repository.

For Python 2.X:

For Python 3.X:

Among other things, the Homebrew version of Python will install “pip”, which is Python’s own package management program. Pip works a lot like Homebrew, allowing installations like this:

If you’re familiar with Python, you’re probably already familiar with Pip, so we’ll leave it at that.

Ruby & Homebrew

Homebrew is written in Ruby on Rails, as are its formula, so Homebrew is already a Ruby haven. Unsurprisingly, there are also lots of options for using Ruby with Homebrew.

Multiple Rubies

If you need to test against different versions of Ruby, you can install rbenv to manage them; afterward, you should install ruby-build to actually access those different versions:

At this point, you should have a ridiculous number of Ruby versions to choose from:

01c-02-Ruby-Installs

You’ll probably also want to install rbenv-default-gems, which will automatically install gems when you install new versions of Ruby:

You’ll now able to install individual versions of Ruby and set them as the global default using the rbenv command:

You can also install individual gems as usual using the “gem” command. However the further complexities of rbenv, multiple ruby versions, and their individual gems goes beyond the scope of this article, so we’ll close this topic now, with the basic installation complete.

Individual Gems

If you don’t need to use a specific version of Ruby (or if you don’t want to deal with the complexities of multiple versions of Ruby), you can instead stick with MacOS X’s installed version of Ruby. In this case, you probably want to install the brew-gem package:

Afterward, you’ll be able to install gems directly from Homebrew, allowing them to be better integrated with your Homebrew setup:

Once you’ve brewed a gem using brew-gem, you’ll see it installed as part of Homebrew, in the right place in /usr/local. Note, however, that brew-gems does not currently provide a clean method for uninstalling your gems!

Conclusion

In one short post we can’t possibly describe every great Homebrew package for developers, nor can we fully detail how to use languages like PHP, Python, and Ruby with the Homebrew software. However, this article should have offered a start — both in finding great software for your Mac and in integrating your favorite web development system with a great package management software.

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:

Comments are closed.