Categories
Technology

Macports, Unix, and Graphics

Recovered from the Wayback Machine.

My upcoming book, Painting the Web includes considerable coverage of technology-enabled graphics. Of course, all graphics are technology enabled, but when I say ‘technology-enabled’ I mean graphics via command line tools or accessed through programming language such as PHP.

What to cover wasn’t an easy choice. For instance, how much programming experience should we assume the reader has? Little? Lots? In the end, I focused the writing at a reader who has had exposure to JavaScript and/or PHP, but didn’t have to be either a pro or an expert.

Then there was the issue of the Unix command line, and installation applications for the Mac, such as Macports. Even experienced PHP/JavaScript developers may have no exposure to the Unix command line. Yet there is a wealth of resources available–in Linux and on the Mac–for people interested in graphics who are willing to forgo the desktop interface and get your Unix on, as the saying goes.

In the end, I covered these tools but promised the reader that I would provide web pages with up-to-date links to helpful tutorials and resources that could get them up to speed, either on Unix, or in the programming languages used. This includes one of my most used applications, MacPorts, the installation software useful for installing Unix-based applications on our computers.

Why would you be interested in MacPorts, especially if you’re into graphics?

When I was getting ready for Painting the Web, I spent an entire day downloading and installing software I planned to cover in the book on one of my Macs. An entire day, literally dozens of applications, and yet all combined, none of it took over a gigabyte on my hard drive. That’s one of the real advantages to using an application like MacPorts and free and open source applications that can be installed with this tool. In the graphics port area alone you have applications such as GIMPUFRaw (a RAW editor), Inkscape for vector graphics, the GD graphics library that I use so extensively at this site, libexif for parsing the EXIF section of a photo, and hundreds of other applications, including my favorite, ImageMagick.

Ah, ImageMagick. I can never say enough about ImageMagick. It has got to be one of the most entertaining sets of graphics tools in the living world. Best of all (well, other than it being free) most hosting companies have some version of ImageMagick installed, so you can access the command line tools without having to install them on your own Mac (or Windows, there is a Win version of ImageMagick). Still, if you can get a local copy on your Mac, installing this application pays for the Macports installation, all by itself. When you do install the tool set, make sure to spend time with the online examples, as documentation is a bit light for ImageMagick.

It’s a little ironic that one of the first things I wrote in a book on web graphics was to encourage people interested in graphics to become familiar with the Unix command line. The Unix command line is one of the most non-graphical technologies that exists today. Graphics, though, does not begin and end solely in Photoshop–limiting your tools to those that have a GUI and that are installed with one click of the mouse limits the amount of fun you can have with graphics. And if we’re not having fun, why bother?

  • You will need to install the Apple X11 system using the Mac OS X Install Disc, first. The MacPorts instructions cover this.
  • Next is MacPorts of course. You may have also heard this application called, “DarwinPorts”. The site has a list of ported applications, as well as excellent documentation.
  • Another MacPorts tutorial, providing more of an overview. You can also find an overview of MacPorts at Lockergnome.
  • I don’t use a GUI to MacPorts, but some of you might like one. There are several, including PortAuthority and Porticus. The benefit of a GUI tool is that it can be easier to see, at a glance, what’s installed.
  • One of the advantages of using MacPorts is installing applications that work together, such as the LAMP trifecta: Apache+MySQL+PHP. I found a couple of different tutorials on using MacPorts for installing these three applications: a fairly detailed and involved approach, which might be a little intimidating to new command line users; steps for a Leopard installation. I’m not running Leopard, so I’m not sure how accurate the steps covered are. Frankly, if you don’t need the trifecta, and you’re just playing around with the graphics, I’d get more comfortable with MacPorts and the command line before installing these three. If you want to try some of the PHP-based graphics applications, though, you’ll have to install at least Apache and PHP.
  • One thing about MacPorts is that if there is an application dependency for the application you’re installing, the tool automatically downloads and installs this dependency. I have found that with GIMP, if I use MacPorts to install UFraw, first, it downloads and installs the latest GIMP, and then integrates the two. With this integration, UFraw pre-processes a RAW photo, first, before passing the photo on to GIMP. Regardless, of how you install the tools, you’ll definitely want to be consistent: if you use MacPorts to install UFRaw, don’t use the standalone click installer for GIMP–use MacPorts. Otherwise the GIMP application is installed in the wrong place, and UFRaw can’t find it.
  • ImageMagick is also an available port on MacPorts. There are a significant number of dependencies for ImageMagick, so it make take a considerable amount of time to install this application. May I say, though, that the results are worth the effort? Unfortunately, most of the programming language interfaces to ImageMagick are not in ports. For instance, I use iMagick (source), a PHP-based ImageMagick wrapper, which is accessible via PECL, a PHP extension system, but not MacPorts. No worries, though, as these language-based wrappers are typically quite easy to install. If you’re a Ruby user, you’re in luck: RMagick is a MacPorts port.
  • Throughout all of this, even if you use a GUI MacPorts interface tool, at some point, you’re going to be messing with the Terminal application for the Mac. The Terminal provides an interface into the underlying Unix system, and command line. There are tutorials in using the Terminal, including a TidBits tutorial (part 2 and part 3) and several older articles from O’Reilly.
  • There are a ton of Unix command line how-tos, helps, and tutorials. The nice thing about the Unix command line is the tools you use most, rarely change. Benjamin Han has provided several Mac Unix how-tos, this Mac forum thread provides some nice jumping off points, and there are a couple of books for Mac users covering the command line, though I haven’t read any and so can’t provide a recommendation. You might also want to spend some time with shell scripting especially if you want to package your ImageMagick commands.

This is a start, and I’ll be adding to this list before I formalize it into a separate reference page. If you know of any other resource that should be included, please drop me a note or leave a comment.

Of course, it goes without saying that even the best laid plans go awry, and you’ll want to backup your hard drive before installing MacPorts and any of the applications. I also recommend searching on “MacPorts” and the application name in Google or Yahoo, first. You can sometimes find better ways of installing sets of applications, such as Apache2+PHP5+MySQL. If you’re using Leopard, or running on an Intel-based Mac, you’ll also want to double check that the application does work in your environment.

Happy MacPorting.

Print Friendly, PDF & Email