Skip to content
Thoughtful, detailed coverage of everything Apple for 34 years
and the TidBITS Content Network for Apple professionals

Mac OS X: Breeds of Programs, Part 2

In the previous installment of this article we looked at three of the five breeds of programs that run in Mac OS X: Classic, Carbon, and Cocoa. Those three are most notable because they’re used for the majority of current Mac OS X programs. Because all three of these APIs (application programming interfaces) are proprietary to Apple, they’re available only in the Mac OS, and Apple is actively working to make them a productive and pleasant environment for Macintosh users and developers. However, Mac OS X also supports the public Unix and Java APIs that provide access to a plethora of cross-platform programs, including many types that aren’t available in Classic, Carbon, or Cocoa. This week we’re going to concentrate on the wide variety of Unix applications that you can run in Mac OS X; we’ll save Java for the next installment.


The core of Mac OS X is Darwin, a full-blown Unix operating system. When you start Mac OS X, Darwin boots up, finds and mounts hard disks, starts virtual memory, and begins running various programs. Some of those programs are Carbon and Cocoa applications, such as the login window and the Finder, but others are standard Unix programs, like the Apache Web server.

Types of Unix Programs — Unix programs come in many different types, and full-blown interactive applications are greatly outnumbered by tiny command-line utilities and non-interactive server programs. In fact, almost every command you type at the Unix command line is a small program, but one you run from the command line rather than by double-clicking. To access Mac OS X’s Unix command-line prompt, launch the Terminal application from the Utilities folder in your Applications folder. Type "ls" (without the quotes) to run the program that lists files in the current directory, which is essentially what the Finder does every time you open a new window. Other core commands include more, which displays text files, and man, which displays online help called "manual pages." To learn about each of these commands, try typing "man ls", "man more", and "man man" (once you’ve started man, press the space bar to scroll, and type q to exit). Hundreds of these small command-line utilities are included with every version of Unix; to see most of them, type "ls /usr/bin". Don’t let this overwhelm you – although it’s possible to learn Unix purely from the online help, there are, of course, hundreds of books on Unix available (some were recommended in last year’s TidBITS gift issue).


Most of these programs are much simpler and smaller than Mac applications – copy, delete, and list files are three different Unix commands (cp, rm, and ls, respectively). In comparison, the Finder includes these capabilities and a great many more in a single application. Some programs in /usr/bin, however, are full-blown interactive (but text-based, rather than graphical) applications, with their own user interfaces, such as the vi and emacs text editors.

In addition to command-line tools, Unix systems sport a great many server programs, the most well-known probably being the Apache Web server. Apache runs invisibly in the background, responding to requests from Web browsers and recording its activity in log files. This approach is an inversion of a typical Mac application, where the interface is the centerpiece, and the rest of the program exists to satisfy requests made through the interface. There are a few such faceless programs on Mac OS 9, but they’re common (and totally essential) on Unix systems.

Most full-blown Unix applications use the X11 Window System (often called X Windows) to provide graphical interfaces. X11 itself may feel more primitive than the Quartz and QuickDraw imaging systems which manage text and graphic display for Carbon, Cocoa, and Classic applications, but X11 is available for a wide variety of systems, facilitating cross-platform development. Because there are so many alternative X11 window managers, it offers tremendous flexibility, far beyond Apple’s customization options. In addition, X11 was designed for network environments; X11 programs can display their windows on remote X11 systems across the Internet (even running different operating systems), so X11 programs implicitly include many of the capabilities of programs like Timbuktu. X11 isn’t included with Mac OS X, but free and commercial versions are available.




Getting & Installing Unix Programs — One of the best things about Unix is the vast number of freely available programs, but with this richness comes complexity. Because programs are normally compiled for a specific processor type and operating system (such as Apple’s System 7 on a Motorola 680×0, or Linux 2.2 on an Intel Pentium-series processor), Unix programs are mostly distributed as source code kits, intended to be compiled on a variety of operating system/processor combinations. Developers can’t test against every system configuration, which makes Unix software far less plug-and-play than Macintosh and Windows software. Worse, Unix programs often require adjustments to their source code to work on a given system; this process of adjustment is called porting. Since most users don’t want to port programs before using them (or more likely, aren’t capable of it), Unix developers go to considerable trouble to make their software work on a wide variety of systems, but there are always gaps, especially with new operating systems like Mac OS X.

The Unix world addressed this problem with package management systems that simplify the process of porting and installing software. Some, like Red Hat’s RPM, install pre-compiled packages, but this approach suffers from size bloat and version dependency confusion. Others, like the Debian GNU/Linux dpkg utility, perform source code porting using automated recipes for compiling software – start with a source package, unpack it, make these changes, compile it with those commands, and install it with another command, and so on. Automated source code porting eliminates the size problems in the pre-compiled binary package approach, but it does require the user to have development tools available, something that’s almost certain in Unix generally, but less so in Mac OS X since many people upgraded to Mac OS X 10.1 without getting the Developer Tools CD-ROM. You can download all the Mac OS X developer tools for free, but at over 200 MB, downloading isn’t feasible for all users. In reality, most package management systems combine both approaches, in an attempt to provide the best of both worlds.

Several package managers are available for Mac OS X, but Fink – an adaptation of Debian GNU/Linux’s dpkg – is currently the best of the lot. It includes straightforward instructions and can install a great many Unix programs without requiring the user to understand the details of compiling and installing Unix software. Fink also normally installs software in its own directory, making it easy to uninstall cleanly, something that’s not otherwise guaranteed. Fink is available in both source-only and binary-and-source versions; both can compile a broad range of Unix programs, and the binary distribution includes pre-compiled versions of the most popular software. The neat thing about Fink is that only one person has to figure out how to port a particular Unix program to Mac OS X and submit their procedure, after which anyone else can have Fink follow that recipe and install the same software automatically.


For Mac users who prefer to avoid dealing with Unix and its applications directly, programmers are creating graphical applications to manage specific Unix facilities. There’s Brick House, which provides an Aqua interface to the ipfw firewall built into Mac OS X, or MemoryStick from TidBITS’s own Matt Neuburg, which graphically displays your RAM usage using the Unix vm_stat memory utility. There are also more general tools to bring Unix power into Mac OS X’s Aqua environment, including ShellShell and DropScript. ShellShell is an extensible tool for generating Unix command lines from a graphical interface, executing them on behalf of the user, and showing any results to the user. It uses its own configuration language, and the author, Robert Woodhead, invites others to submit their own modules for use with ShellShell. Wilfredo Sanchez’s DropScript takes a different tack – the user first drops a script containing Unix shell commands onto DropScript to create a new Cocoa application from the script. Then, any files dropped onto that DropScript-created application are processed by the original shell script as if the user had typed the appropriate commands. This makes DropScript an easy way to provide pre-built command line programs to compress, back up, or otherwise manage files from the Finder.

< brickhouse.html>




Finally, there are a variety of commercial Unix programs. They’re often much more expensive than their Mac and Windows counterparts, and sometimes more powerful as well. For these high-end developers, Mac OS X provides a familiar Unix-based environment with OpenGL graphics support (OpenGL is a cross-platform API for accelerated 3D graphics) that facilitates porting products like Alias Wavefront’s Maya. Maya is a heavy-duty animation program used for everything up to full-length feature films. Maya would never have made it to Mac OS 9, but it’s available on the Mac now, thanks to Mac OS X’s Unix core.

< /index.jhtml?page=/en/Community/osx_main _m/osx_main_m.shtml&style=normal>

Environmentally Friendly Mac OS X — The Mac OS has traditionally stood alone, but Mac OS X’s Unix foundation throws open the doors to new applications and uses. Some of those are coming from traditional Unix applications – generally command-line tools and servers – ported to Mac OS X, but that’s not all. Brick House and other programs that provide graphical interfaces to Unix tools offer a great deal of power to Mac users without resorting to the often arcane command line. Developers are also starting to take advantage of Unix’s power for Mac programs – as with Interarchy, which has leveraged the ssh command built into Mac OS X, and BBEdit, which can now run shell scripts directly. Finally, high end Unix programs like Maya are starting to appear on the Mac. Still, Unix in Mac OS X is something of a wild card – Unix provides vast power and flexibility for text manipulation, networking, programming, collaboration, and security, but how this power will be directly exploited in Mac programs, and by Mac programmers, remains to be seen.

[Chris Pepper is a Unix system administrator in New York City. He’s amused and somewhat surprised that Mac OS X has turned out to be such a great management workstation for the Unix systems he works with. Chris is involved in various documentation efforts, including those for Interarchy and the Apache Group.]


Subscribe today so you don’t miss any TidBITS articles!

Every week you’ll get tech tips, in-depth reviews, and insightful news analysis for discerning Apple users. For over 33 years, we’ve published professional, member-supported tech journalism that makes you smarter.

Registration confirmation will be emailed to you.

This site is protected by reCAPTCHA. The Google Privacy Policy and Terms of Service apply.