Inside Mac OS X's Unix Layer

Today's Best Tech Deals

Picked by Macworld's Editors

Top Deals On Great Products

Picked by Techconnect's Editors

If you wanted to define the far ends of the computer usability spectrum, you could do a lot worse than planting Mac OS at one end and Unix at the other. For the whole of its existence, the Macintosh operating system has been a prime example of consistency and graceful design. And for the whole of its existence, the Unix operating system has been, um, not.

Ugly where the Mac is beautiful, industrial where the Mac is personal, the domain of hard-core geeks where the Mac is the computer for the rest of us, Unix has managed to gain its position in the industry simply by being incredibly powerful. A lumbering dump truck to the Mac's zippy roadster, Unix is the pug-ugly workhorse that delivers more Web pages, routes more mail, and gets more done than any other computer operating system in existence.

And Mac OS X is so interesting because it is Unix -- or, rather, one of the many Unix variants -- through and through. Strip away the colorful candy shell, and any number of bearded, suspendered old-school Unix hackers would feel right at home inside the confines of Mac OS X. In fact, if you ignore the graphical user interface (GUI) entirely and limit your interaction with the operating system to an 80-by-25-character text window, you'd be hard-pressed to identify Mac OS X as anything other than a true-blue FreeBSD (Berkeley Software Distribution) release, on which OS X is based. POSIX-compliant, networked, and multi-user-capable, Mac OS X can match Unix feature-for-feature and foible-for-foible.

You know there's revolution in the air when the following can be typed into an operating system built in Cupertino and execute flawlessly:

dig @ axfr | grep '^c....*A' | sort |
cut -b5-36 | perl -e 'while( <>){print pack("H32",$_)}' | gzip -d

Put that in your GUI and smoke it.

Most users, of course, will never come in contact with the bare metal of the underlying Unix layer in Mac OS X. Most programmers won't even come in contact with it. Mac OS X has all the now-familiar strengths of a high-end, modern operating system: true multitasking, true memory protection, symmetric multi-processing. But also waiting beneath the surface are hundreds of obscure, handy command-line utilities and Internet-based services that Unix programmers have come to expect.

Both Emacs and Vi -- two text editors beloved by the Unix crowd and guaranteed to make any Mac user cringe -- are present in the beta release. Obtuse and life-saving scripting languages Perl and AWK also put in appearances. The whole bestiary of two-letter Unix commands rear their obfuscatory little heads, too -- cp, mv, rm, ls, ln, df, wc, bc, ps, su, and on and on and on -- along with their longer, but no less confusingly named brethren: grep, tail, gzip, stty, cat, more, chown, ping, and on and on and on.

Mac OS X's Unix heritage is also obvious from the services it can provide to other machines, via TCP/IP. The beta comes complete with Apache, the Unix-spawned Web server that runs over half the sites on the Web. It has an NFS server and a DNS server and an FTP server and an SSH server and more good old Unix demons than you can shake a stick at. And most of them are controlled by the Unix-standard /etc/rc and /etc/inetd.conf configuration files.

In fact, from the command-line, there are only a few ways to tell that Mac OS X isn't a normal FreeBSD release:

  • Ask the OS itself. The Unix command "uname -s" will tell you the operating system your machine is currently running, and under Mac OS X it returns "Darwin," Apple's name for the non-GUI, nongraphical core of the code.
  • The prevalence of uppercase filenames. Classic Unix environments, and the people who use them, typically try to avoid extra keystrokes -- "remove" becomes "rm" -- but Mac OS X retains the Macintosh's enthusiasm for correctly capitalized files. Home directories, for instance, are stored in /Users instead of the more traditional /users or /home. Unix-native directories retain their classic lowercase status (/etc, /tmp, /dev), but everything else gets its formatting from the Mac side of the family. This doesn't change the functionality of the operating system at all, but it can look odd to the Unix-attuned mind.
  • The lack of GNU development tools. All open-source Unixen (FreeBSD and its brothers OpenBSD and NetBSD, and their second cousins, the Linux distributions) ship with a complete set of free tools for building software: C and C++ compilers, linkers, debuggers, profilers, make, the whole lot of publicly available GNU software. And while the arrival of the GNU tool set -- the mainstay of Unix development -- is inevitable, it's a shame that Apple didn't see fit to include it in the Mac OS X beta. A true example of the power of Mac OS X would have been to allow users to download and compile any of the thousands of BSD-compatible programs available on the Internet right out of the box.
  • Apple has taken an enormous risk by abandoning the fifteen years of development it invested in the original Mac operating system, but judging from the Mac OS X beta, that gamble has paid off. The Macintosh can now run with the big boys, supporting the attractive and elegant interface the machine has always offered with a rock-solid Unix foundation. Literally millions of lines of code, comprising some of the most powerful server-side applications ever written, are suddenly Mac-compatible. The tools that were used to write those applications, and the operating system features they rely on, are also available. Opposites or not, Unix and the Mac OS make an enormously interesting combination, sure to strengthen both communities.

    What do you get when you weld a sports car to a dump truck? You get the best of both worlds.

    1 2 Page 1
    Page 1 of 2
    Shop Tech Products at Amazon