MacDevCenter    
 Published on MacDevCenter (http://www.macdevcenter.com/)
 See this if you're having trouble printing code examples


Why Unix Matters to Mac OS X

by Daniel H. Steinberg
10/03/2002

When you think of open source and Unix, is your next thought Mac OS X? The O'Reilly Mac OS X Conference is the third Mac developers conference this year that company founder and president, Tim O'Reilly has keynoted. Sure this is his conference and he can do anything he wants, but earlier this year he spoke to developers at Apple's Worldwide Developers Conference and to hardcore Mac geeks at the Mac Hack conference. And then there's Jordan Hubbard. Sure, he's now an Apple employee, but he's known for his work on FreeBSD.

Hubbard and O'Reilly are two men with a solid background and reputation in the Unix and open source communities. Each delivered morning keynotes at the O'Reilly Mac OS X Conference that recounted lessons learned in their Unix past and described what they each like about Mac OS X. Many Mac programmers are using Unix for the first time now that it's available on Mac OS X. Many Unix programmers are using the Mac for the first time now that their favorite tools are available on the platform. In an informal audience survey, almost 80 percent of the audience were Mac users before Mac OS X as well as Unix users before Mac OS X.

Innovation and the Future

Sometimes it's hard to figure out what the future will bring. O'Reilly suggested that really you just need to look around and ask the right people. He quoted William Gibson, "The future is here, it's just not evenly distributed." So how do you figure out what's coming? O'Reilly related the story of a toy company looking for beta testers. They would go ask kids "who's the coolest kid you know?" They would then follow the trail until a kid answered, "I am." O'Reilly sees his core business as serving the alpha geeks, the inventors of the future. He tries to spot and follow interesting thinkers and the people they think are doing interesting things.

O'Reilly looked at the various stages of technology evolution. The first stage is the hackers. A hacker is someone who pushes the envelope. When the tool they're using on a computer doesn't do what they want, they figure out a way to do it anyway. The second stage is the entrepreneurs. These people make things easier for ordinary users. Mac OS X has many cool tricks available from the Terminal, but they don't exist for ordinary users until there's a GUI front end that's easy to use.

Related Reading

Free as in Freedom [Paperback]
Richard Stallman's Crusade for Free Software
By Sam Williams

The third stage, according to O'Reilly, is the scary one. This is the stage where dominant players integrate the technology into a platform and either raise barriers to entry or build a healthy ecosystem. This can be stifling in the Windows space. Microsoft figured out that if you offer a platform and make things easy for people then you've got control. Unfortunately, O'Reilly cautioned, if you take too much control you dry up innovation. O'Reilly said that his mom told him that Bill Gates sounds like someone who'd come over for dinner and say, "I'll take all the mashed potatoes." When the dominant players take over a technology, the hackers and the entrepreneurs are no longer interested so they go on to look for other opportunities.

Why Unix Matters to Mac OS X

O'Reilly urged Mac developers to think about the architecture philosophy of Unix. The Unix ideal is to keep things small and modular and help others use your application by providing information. When you write a Unix program you then write a man page for it. For example, the popular Mac text editor BBEdit has been available for a decade on Macs that didn't have Unix or a Terminal window. With Mac OS X you can call BBEdit from the command line. BareBones Software understands the responsibility that comes with this and provides a man page that lists the optional flags you can set. O'Reilly said that it's unlikely that people writing a dll for Windows think to write a corresponding document that's available to all users.

He suggested that Mac developers read Kernighan and Pike's book on the Unix Programming Environment to understand the idea of small cooperating programs designed to work together. He quoted Jon Postel's Robustness principle, "be conservative in what you do, be liberal in what you accept from others." O'Reilly's lessons learned were to adhere to standards and keep things small and modular.

O'Reilly's final lesson was one also learned from Microsoft, "a platform beats an application every time. AppleScript matters because you get a virtuous circle of hacker innovation." As you develop applications, think about what it means to be a platform. Create hooks so that other people can write to it. Think about extensibility and interoperability when you create an application. He advised developers to think of their applications as "network and open applications. Play well with others and have fun."

Darker Lessons from Unix

Jordan Hubbard began his keynote with a history of Unix and an explanation of what led him to join Apple. Before Unix, operating systems only came from hardware vendors. The early hardware was big and expensive with no concept of portability, sleep, single user, graphics, or any non-ASCII display. In 1969 Ken Thompson designed a little OS at Bell Labs that interested folks into typesetting, language developers such as Dennis Ritchie, and tool-age philosophers who wanted to write small tools that would do one thing and do it well. In 1975, AT&T seeded Unix to universities. At U.C. Berkeley, BSD Unix was the first big offshoot. There the programmers added virtual memory, long filenames, terminal independent I/O, the first screen editor, job control, and the fast filesystem.

Related Reading

Mac OS X for Unix Geeks
By Brian Jepson, Ernest E. Rothman

Once Unix took off, AT&T saw the commercial potential. BSD was adopted by Sun Microsystems and by DEC and lines were drawn and wars were fought. There were fights for vendors and market share and for window systems. The result was that Unix commercial software was too expensive and too late. BSD was under a legal cloud during this formative time. Hubbard pointed out that Unix then lost the desktop. Things that end users wanted to do weren't available. There was no support for printers or multimedia. Unix engineers weren't interested in these "user-level problems". Because Unix had the reputation of not being user-friendly, many didn't see the point in making it user-friendly.

In some ways, Unix itself should have died. Hubbard explained that the essential tool-building philosophy is a good one. Small building blocks make a lot of sense and led to an object-oriented programming renaissance. Combine this with an open system and smart and influential people in the Unix community and Unix survived this period. And then the Internet changed the rules. TCP/IP stacks became important and much of this innovation occurred on Unix first. Unix also has great networking and service delivery capabilities and is a natural server solution. At the same time, the Open Source Movement broke the vendor lock on standards so the vendors can't have the fights that marred the early days. BSD finally got out of its lawsuit and a free version of BSD was released with the blessing of Novell (who bought Unix from AT&T and settled the lawsuit).

Why Mac OS X Matters to Unix

Hubbard sees a lot of benefits to Unix users using a Mac. He talked about the benefits that Apple delivers to the Unix community. Throughout Unix's history it was difficult to get software vendors to write affordable and timely Unix versions of their software. The Windows version would be available earlier and be much more affordable than the Unix version. Hubbard is pleased at the offerings from third parties, citing the Java implementation as an example. The culture at Apple means that real attention is paid to internationalization and alternative-access methods.

The video and graphics support on a Mac make it a compelling platform for Unix users. Hubbard's favorite part of the OS is Quartz. Every application can generate and render PDF. You get fast anti-aliasing of line art and Unicode text. An advantage of Apple being a for-profit company is that they can license the fonts. On the Mac, there's no work to do to enable OpenGL. It is tightly integrated with hardware for maximum performance. Hubbard likes being able to play his DVDs. He joked that you can play your DVDs on a Unix box, but you have to break a lot of laws--including just thinking about it.

With Mac OS X, a solid consumer version of Unix is winning back the desktop. Hubbard explained that Mac OS X is not just another Unix. The Mac has good power management, which is critical to making Unix portable. Mac OS X is based on the Mach microkernel. Hubbard has come to appreciate the kernel support for messaging and threading. The IOKit provides the device driver APIs so that you can separate out the device instance-specific core from the common code. With the Mac you have a Unix box that supports plug and play for devices.

Hubbard concluded that "Mac OS X can win the war that Unix lost and get Unix to the desktop. Twenty-five million users is a compelling argument." Combine the strong relationships with ISVs with the sexy hardware, and open source software that is bringing the developers back to the platform, and a lot of cool software is being hacked out.

Daniel H. Steinberg is the editor for the new series of Mac Developer titles for the Pragmatic Programmers. He writes feature articles for Apple's ADC web site and is a regular contributor to Mac Devcenter. He has presented at Apple's Worldwide Developer Conference, MacWorld, MacHack and other Mac developer conferences.


Get more conference coverage here.

Return to the Mac DevCenter.


Copyright © 2009 O'Reilly Media, Inc.