Once upon a time, Unix came with only a few standard utilities. If you were lucky, it included a C compiler. When setting up a new Unix system, youd have to crawl the Net looking for important software: Perl, gcc, bison, flex, less, Emacs, and other utilities and languages. That was a lot of software to download through a 28.8-Kbps modem. These days, Unix distributions come with many more features, and more and more users are gaining access to a wide-open pipe.
Free Linux distributions pack most of the GNU tools onto a CD-ROM, and now commercial Unix systems are catching up. Solaris comes with a companion CD of free software including a big selection of GNU utilities, and just about every flavor of Unix (including Mac OS X) now includes Perl. Mac OS X also comes with many tools, most of which are open source and complement the tools associated with Unix.
This book serves as a bridge for Unix developers and system administrators whove been lured to Mac OS X because of its Unix roots. When you first launch the Terminal application, youll find yourself at home in a Unix shell. However, Apples credo is Think Different, and youll soon find yourself doing things a little differently. Some of the standard Unix utilities youve grown accustomed to may not be there, /etc/passwd and /etc/group have been supplanted with something called Directory Services, and when it comes to developing applications, youll find that things like library linking and compiling have a few new twists to them.
Despite all the beauty of Mac OS Xs Aqua interface, youll find that some things are different on the Unix side. But rest assured, the changes are easy to deal with if you know what to do. This book is your survival guide for taming the Unix side of Mac OS X.
Audience for This Book
This book is aimed at Unix developersa category that includes programmers who have switched to Linux from a non-Unix platformas well as web developers who spend most of their time in ~/public_html over an ssh connection, and experienced Unix hackers. In catering to such a broad audience, weve chosen to include some material that advanced users might consider basic. However, this choice makes the book accessible to all Unix programmers whove switched to Mac OS X as their operating system of choice, whether they have been using Unix for 1 year or 10. If you are coming to Mac OS X with no Unix background, we suggest that you start with Learning Unix for Mac OS X Tiger by Dave Taylor (OReilly) to get up to speed with the basics.
Organization of This Book
This book is divided into four parts. provides useful reference information.
Heres a brief overview of whats in the book.
Part I, Getting Around
This part of the book orients you to Mac OS Xs unique way of expressing its Unix personality.
This chapter provides you with an overview of the Terminal application, including a discussion of the differences between the Terminal and the standard Unix xterm.
This chapter introduces Spotlight, a subsystem for searching your Mac. In this chapter, youll learn how to access this powerful metadata store from the command line.
Here youll learn about the layout of the Mac OS X filesystem, with descriptions of key directories and files.
This chapter describes the Mac OS X boot process, from when the Apple icon first appears on your display to when the system is up and running.
This chapter gets you started with Mac OS Xs powerful Directory Services system, which replaces or complements the standard Unix flat files in the /etc directory.
This chapter explains how to set up a printer under Mac OS X and shows you around CUPS, the open source printing engine under Mac OS Xs hood.
In this chapter, youll learn how to install and work with the X Window System and how to use both built-in Mac OS X and third-party tools for establishing VNC connections between Mac OS X and other Unix systems.
This chapter introduces some third-party applications that put a new spin on Unix features, such as SSH/SFTP frontends, TeX applications, the statistical package R, and multimedia-related applications.
Mac OS X isnt the only operating system you can run on your Mac. In this chapter, youll learn how you can run many operating systems on your Mac, perhaps even two or three at a time.
Part II, Building Applications
Although Apples C compiler is based on the GNU Compiler Collection (GCC), there are important differences between compiling and linking on Mac OS X and on other platforms. This part of the book describes these differences.
This chapter describes the peculiarities of the Apple C compiler, including using macros that are specific to Mac OS X, working with precompiled headers, and configuring a source tree for Mac OS X.
Here we discuss building libraries, linking, and miscellaneous porting issues you may encounter with Mac OS X.
Part III, Working with Packages
There are several packaging options for software that you compile, as well as for software you obtain from third parties. This part of the book covers software packaging on Mac OS X.
In this chapter youll learn all about Fink, a package management system and porting effort that brings many open source applications to Mac OS X.
MacPorts offers another way to install lots of open source software on your Mac. Youll learn all about it in this chapter.
This chapter describes the native package formats used by Mac OS X, as well as packaging options you can use to distribute applications.
Part IV, Serving and System Management
This part of the book talks about using Mac OS X as a server and discusses system administration.
In this chapter, youll learn about setting up your Macintosh to act as a server, selectively letting traffic in (even through a Small Office/Home Office firewall such as the one found in the AirPort base station), setting up Postfix, and setting up and configuring MySQL and PostgreSQL.
This chapter describes commands for monitoring system status and configuring the operating system.
This chapter describes the versions of Perl, Python, Ruby, and Java that ship with Mac OS X, as well as optional modules that can make your experience much richer.