Mac OS X: Real Unix, Real Power

When the world got its first glimpse of Mac OS X six months ago with the release of the Mac OS X beta, cheers erupted across the Internet . . . but not from who you might have expected. While the response from the Macintosh community was muted and many of the Apple faithful greeted OS X with trepidation, hard-core Unix geeks were thrilled. Looking past the candy-colored GUI, command-line partisans could find a solid Berkeley Software Distribution (BSD) Unix implementation, complete with everything they've come to expect from a "real" multiuser, multitasking operating system. Suddenly, old-time hacks could count Mac OS among their favored few.

The changes made to OS X since the beta will only reinforce that enthusiasm. While users familiar with more mainstream Unix implementations face a handful of interface oddities, the heart of the system they know and love beats proudly underneath Apple's shiny, polished skin.

The most obvious change since the beta is the inclusion of a whole range of traditional Unix development tools. Apple has done the Right Thing with OS X and shipped a C/C++ compiler, preprocessor, make, and debugger -- all are either direct compiles of, or tweaks "based on," the GNU versions of the programs. More obscure tools like yacc and lex have also made the cut, along with the must-have configuration management system CVS and the less useful but still popular RCS. These applications are important because they open a whole world of freely available software to OS X, right out of the box -- everything from heavy-duty relational databases to housekeeping and system administration tools. Apple has honored a fundamental tenant of the Unix Way: If you've got a compiler, you've got everything.

For instance, the current version of MySQL -- a popular (and enormous) implementation of most of the SQL spec -- compiles on the final release of Mac OS X almost flawlessly. (There is one miscast assignment, and it can be corrected with a three-character change.) The database exercises a whole range of system features, including the C++ compiler, threading, and forking, and with the exception of the database replication tests, it all works perfectly. Why would you want a gigabyte-capable database on your desktop Mac? Why not? The possibilities are breathtaking, and suddenly open to the entire Mac community. In the Unix world, MySQL is used for everything from the simple storage of massive lists to dynamic Web serving, when the database is combined with the PHP language and the Apache Web server (both of which, handily, ship with OS X). The applications are endless.

Another example is Samba, a Unix implementation of Windows' SMB protocol. It allows Windows workstations to use Unix boxes -- and, now, Mac OS X boxes -- as file and print servers. Half a million lines of Samba code compile without a single error on OS X. In fact, the only modification needed was in the configuration script, to tell it that "Darwin" is the equivalent of "FreeBSD."

This last point is significant because the operating system is a little schizophrenic about how it identifies itself -- variously labeling the machine as either "Darwin" (Apple's name for the nongraphical core of OS X) or "Mac OS X." For example, the make program claims to have been created for "powerpc-apple-darwin1.0," while the debugger was targeted to "powerpc-apple-macos10." The uname command offers "Darwin" as the OS flavor and after an inevitable shake-out period, that will probably emerge as the consistent standard.

Mac OS X even includes a few neat tricks of its own, over and above what other popular Unix and Unix-like operating systems manage. The whole notion of bundled Frameworks -- used to store multiple versions of shared libraries -- is a clever improvement on the chaos that usually reigns after a system upgrade. By preserving older versions of the libraries, and in a much more coherent form than the Unix tradition allows, the OS becomes far more stable over time. OS X makes good use of these ideas to maintain its Java installation, for instance, while still providing the software in their standard Unix directories through symbolic links.

Another neat toy is the ability to invisibly use WebDAV URIs as filesystems, via the mount command. Using Web resources as storage space is old hat for Mac users, but it's not a widespread practice on the Unix side of the fence.

This only reinforces the fact that OS X is a Macintosh operating system, first and foremost, and that Unix users will need to adapt to some oddities. In an effort to wedge some alien concepts into the Macintosh universe, Apple has made a few compromises to the purity of OS X's Unix nature.

For instance, the most immediate difference between the operating system and true Unix is the presence of dozens of unexpected system directories, many more than in the beta, each with capitalized and whitespace-littered names. In addition to the familiar /etc and /dev and /tmp, Mac OS X offers /Users and /Volumes and /System and many, many others. These latter ones are Mac-centric folders, of course -- including the whole bestiary of Bundles and other OS X-specific hoo-ha. And while they don't reflect the traditional Unix filesystem structure (indeed, they supersede it in some cases), the purpose and function of each is pretty obvious, even to the uninitiated. Having to put quotes around filenames with spaces in them from the shell can take some practice, but preserving capitalization turns out not to be a problem: the OS X's default filesystem is case-insensitive.

And that is another startling difference between what OS X provides and what Unix users expect -- /users is /Users is /USERS, makefile is Makefile is MAKEFILE. Under HFS+, names created with a specific capitalization have their appearance preserved, but any combination of upper- and lowercase can be used when referencing them. This has the potential to drive Unix users batty, as case-sensitivity has been a part of every significant Unix filesystem since the OS was created in 1969. Windows' default, NTFS, presents the same behavior as OS X (to retain backward compatibility with MS-DOS) and HFS+ feels just as awkward to the Unix sensibility.

And finally, a few of the applications shipped with OS X are less powerful than what is commonly available elsewhere. The nvi implementation of the vi text editor has been included, for example, instead of the more powerful vim. It's a simple matter to download and compile vim, of course -- you can do things like that when you're running Unix -- but why should you have to?

Customizing Unix applications is a relatively insignificant issue. Apple's primary goal was to design an operating system for Mac users, and by all accounts they have succeeded wildly. All the underlying functionality of Unix -- all the important bits -- are present and accounted for, and the result is far and away the best Mac OS ever. The system provides every feature and functionality a Unix programmer could want, and provides all of it through a comfortable, well-worn API. Not only does this instantly offer Mac OS thousands of BSD-compatible programs (including some best-of-class offerings) but also lays the groundwork for a new and powerful generation of Mac-specific programs.

The Unix geeks have been mouthing the same line for twenty years now: that their OS honestly does make better programs -- more flexible, more powerful, more robust. Macintosh users are about to find out just how right they are.

Discuss this story and other Mac OS X items in our Mac OS X Forums.

1 2 Page 1
Shop Tech Products at Amazon