sympleko (Matthew Leingang) writes with his review of Running Mac OS X Panther, by James Duncan Davidson. "The Macintosh has come a long way in twenty-plus years. Much has been said of Mac OS X being the perfect union of a rock-solid operating system with a beautiful and functional user interface. Since the iMac, Apple's market share has been steadily increasing, and since OS X, Unix users have been making the switch. My last computer was a dual-boot box that I kept finding excuses to keep from booting to Windows. My PowerBook is literally the best of both worlds. I can run the older unix-based apps I need to for work, and use Microsoft programs and play fancy games when I want. It's also essentially two different computers. This book is about using that second computer, the workhorse behind the scenes." Read on for the rest.
The book fills a certain niche very well. It is not the missing manual to the iApps or a list of Finder tricks. It's not a primer on Unix for people used to GUIs and Macs (that's Learning Unix for Mac OS X Panther , also from O'Reilly). This book is for users who have administered a machine or network before and want to get the absolute most out of their Mac. It's also useful for connecting your Mac to a network seamlessly. But it's complicated and technical enough if you're the kind of Mac user who doesn't have the Terminal on your dock you might be intimidated. That may not include most slashdot readers, but it's worth mentioning because part of the Mac ideology is that it works beautifully with little trouble. The Unix ideology, however, is also represented: if want to tweak it, you can.
The author illustrates both interfaces to the operating system throughout the book. There are Macintosh applications to access all kinds of system information, whether it's users and groups, preferences, system logs, or services. For those who love Unix and the command line, just about anything you can do with the GUI you can do with the CLI. This makes a nice two-tiered approach to anything you'll want to do. The GUI is fast and easy to learn, but some things (particularly automated tasks) really need to be done on the command line.
The book is written well, and if you happen to be sitting next to your computer while reading it, you'll be constantly torn between the two. There are lots of things you'll want to try right away.
Part I: Getting Started
This part has a charming history of the Macintosh, from the toaster to Panther, complete with snapshots (my favorite parts of these are the disk usage indicators: System Folder: 152K in folder, 167K available.) It's fun to read and discover where on the time line you came into the fold.
Here also is a basic layout of the filesystem, containing parts used by the more Macintosh-y side and the more Unix-y side. For instance, there are several directories (um, folders) called Library; these contain information which might be in an include, share, etc, or lib directory. Better put, these contain supplemental Mac-app-related, non-user data. For Unix applications, the /usr, /var, /bin, /sbin, /etc, are all there.
Of course, there are top-level places to store things, or user-level locations for essentially the same kind of data (applications, preferences, documentation). This is the concept of filesystem domains, which additionally include network and system domains. The whole idea is to allow customization to ordinary users without giving up system integrity and preventing all users from unintentionally corrupting things.
If you haven't used the CLI on the Mac before, the author gives a basic introduction to Terminal.app. Terminal by default uses the bash shell, but there are number of ways to change that if you want. Several text editors are available for editing through the terminal, but unfortunately, the author doesn't talk much about them. True, pico is self-explanatory and vi and emacs users will already have their followers, but a little more than how to exit these programs if they start accidentally (while that's quite useful information) would have been helpful.
There's important extra structure to Mac files that can be (accidentally or intentionally) unlinked on the Unix side. There are commands like ditto, CpMac and MvMac which take care of the important stuff and do exactly what their GUI counterparts do (and more than mv and cp). Also, there's open which is the analog of double-clicking (either apps or docs), and osascript which lets you write and run AppleScript scripts on the fly. More could have been said here about the differences between Mac files and Unix files. What of the resource fork?
Part II: Essentials
This is where the book's meat is. There is first a blow-by-blow account of what happens when you turn on your Mac. If you are interested in seeing all the gory details, you can always hold down Propeller-V during startup and see the BSD diagnostics (even if you don't know what these mean, it's nice to know some progress is being made. Though I love the taste of Mac Kool-aid, I often worry what's going on while that dial is spinning). You can change how the Mac boots by updating (at your peril, as usual) the Open Firmware settings on the chip with nvram. One nice bit of customization from Bell-and-Whistle Land: the graphic shown at boot time is in /System/Library/CoreServices/SystemStarter/QuartzDisplay.bundle/Resources/BootPanel.pdf. The /etc/hostconfig file has Unix-style host configuration information, such as what services get turned on.
Creating your own startup items is relatively easy; it's a matter of putting a directory, shell script, and plist file in /Library/StartupItems. You can also customize what happens after a successful startup. You can present a login window, auto-login as a specific user, or even allow dropping down to console login.
The larger and more powerful a computer gets, the more people want or need to use it, and the more important it is to make sure each user area remains separate. At the Mac lab at which I worked during college in the early nineties, we used RevRDist to make sure every computer in the lab mirrored one with just the right software, fonts, and windows in the right place. The Mac from which we mirrored was locked in the office, not to be touched. Now there are much easier ways to do this without wasting a computer.
It's easy to create and manage users using the the Accounts preference panel. The root user exists, but is essentially not needed. The person who installs the operating system becomes an administrative user, and can bestow that privilege on other users. On the command line, all administrative tasks can be done with sudo, which requires authentication as an administrative user to run, but which contains a slight memory so that passwords don't need to be typed at every command. Although it's discouraged, you can allow the root user to log in.
With the several filesystem domains, each user can manage his or her own preferences. Each application allows access to its own preferences, or they can be taken care of from the command line with the defaults utility. GUI means it's easy to do what you want without knowing exactly what setting to change; CLI means you can automate it easily.
Another important aspect of a multi-user system is in permissions. Like in any good unix, in Mac OS X files have permissions attached to them indicating whether the owner, other users in the owner's group, or all users are allowed to see, edit, or run them. This can be managed through the Finder (with the Get Info menu command), or with the command line with chmod.
Several applications in the /Applications/Utilities folder allow you to keep track of what's running on your Mac. The author demonstrates these:
- System Profile, which shows information about your system's hardware and software. You can use this to check out who made your hard drive and how much RAM you have. Also, every application installed in /Applications is registered here, so you can easily see what versions of which are there.
- Console is another great utility for monitoring your applications. It collects log files from /Library/Logs, /var/log, and ~/Library/Log in a tree for browsing. You can filter views of these logs easily, making this a little more pleasant than tail -f.
- To monitor processes themselves you can use Activity Monitor. Think of it as top on Macintosh Steroids. You can inspect processes to try and figure out what they're doing or kill them if they've stopped accepting input. For super users and developers, you can sample processes to figure out their inner workings. There is probably FMTYEWTK about processes, but it's good know it's there.
- To terminate processes, there's the Force Quit command from the Apple menu, or you can do it through Activity Monitor, or there's good old-fashioned kill.
At the core of the Mac filesystem lies, of course, the filesystem. The Mac OS X Extended Filesystem (HFS+) is powerful yet friendly. It's case-preserving and case-insensitive. The latter means that README and Readme are the same file, but the former means that your original name for the file will be kept without enforcement of case usage. So if you want to call it ReAdMe, that's oK, too.
One of the most powerful features of HFS+ is journaling. This means every change to the file system is kept track of in the event of a system crash. This causes a slight overhead but pays benefits in automatic recovery from crashes without having to run fsck (or be scolded by your computer for its own crash). Fragmentation is also handled smartly; files smaller than 20MB are moved so as to have less than 8 fragments.
Lots of other disk-related activities are covered, including:
- how to mount filesystems of other types, including CDs and DVDs, Apple Filing Protocol, Samba, NFS, WebDAV and FTP;
- The Disk Utility application and its CLI cousin diskutil which do as much as you would want and more with a disk utility. You can check, repair, partition, erase and format any disks. You can even obliterate data by writing over it eight times with random data. Take that, NSA!
- disk images, which are like 21st century tarballs. A disk image contains not only data but its own filesystem, and are mounted onto the user's filesystem just like disks. In addition, disk images can be encrypted to restrict access without a password.
Part III: Advanced Topics
The further along in the book, the less useful it gets. That speaks not the author's skill of exposition or choice of subject matter, but simply confidence in the Mac and the knowledge that I didn't need to know it. For the user administering a single machine, there's no real need to grok the inner workings of Open Directory: it just works. Printing, network services: it all just works. That's good news for Mac users. But it's also good that all this information is available if you really do want to tweak default behavior or configure something that isn't working as it should.
I talked about this book with the systems administrator in my department, and he mentioned that my statements in the previous paragraph are somewhat simplistic. According to him, it was a hard task to have public Mac workstations which mounted home directories from a central Unix computer, and allowed users to have their own preferences and user data (including Dock setups) live in their Unix accounts. Apparently the book that has all the information about networking, warts and all, hasn't been written yet. This book is as good as it gets, so far.
To summarize this part of the book: Open Directory has nothing to do with the filesystem directory. Instead, it's the central location of all authentication information. At one time Unix maintained user information in flat files such as /etc/passwd and /etc/group; with the advent of larger networks that regime has been largely replaced. Open Directory is a liaison between BSD's Pluggable Authentication Modules (PAMs) and Mac's Directory Services on the local end, and LDAP, Rendevous, Kerberos, etc., on the network end. Open Directory can talk to Active Directory as well, to allow authentication across Windows and Mac platforms. Through network (shared domain) authentication, users can log in on networked machines while their names and passwords are stored on a central server. The Directory Access Utility is the tool for this.
NetInfo is the database behind Open Directory. As usual, there are two ways to manage Netinfo information; the GUI NetInfo Manager, and nicl on the command line.
Mac OS X uses CUPS (Common Unix Printing Service) to configure and access printing. The printing chapter shows how to add and manage printers using the Printer Setup Utility, and how to customize jobs with the various settings in the standard print dialog. Like I said, though, printing is much easier than it sounds from this chapter. Rendezvous and Open Directory find the printers you're allowed to print on; you click Print and go.
Networking and network services are also covered here. The author shows not only the theory behind networking, but the settings which allow one computer on a network to find another on another network through the internet. Once this is accomplished, a number of services can be deployed, from FTP to remote login to a personal web site.
There's some useful stuff in the back, including how to install Panther from scratch (but especially what needs to be backed up before you do so!), all those boot key combos you can never remember, and a whole list of other resources, be they books, magazines, web sites, or mailing lists.
Check out this book if you want to learn the gory details of Mac OS X's core. It's short on gimmicks but long on information.
You can purchase Running Mac OS X Panther from bn.com. Slashdot welcomes readers' book reviews. To see your own review here, carefully read the book review guidelines, then visit the submission page.