macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Top Ten Mac OS X Tips for Unix Geeks

by Brian Jepson
05/15/2007

Editor's Note: We noticed that this five year-old article continues to get a lot of attention, so we recently asked Brian Jepson to update the sections that have become dated. Here's his update of this "oldie but goodie."

It's been a few years since the release of the book I co-wrote with Ernie Rothman, Mac OS X for Unix Geeks, and I see that a few things have changed since I originally offered the top 10 tips that I gathered while working on the book. These tips will show you the differences between Mac OS X and other flavors of Unix; help you find the bits that resemble the Unix you are used to; and even feather your nest with ports of popular open source applications.

1. Where's My Shell?

A Unix geek won't get too far without a shell, right? You can find the Terminal application by navigating to /Applications/Utilities in the Finder. Drag the Terminal application to your dock so you can access it quickly.

When you start up the Terminal, you'll be greeted with the default user shell, tcshbash. You can customize the Terminal's appearance and settings by selecting Window Settings from the Terminal menu. You can set the startup shell by selecting Preferences from the Terminal menu.

2. Sudo, Not Su

By default, the root user is disabled on Mac OS X. If you need to do something as root, use the sudo command. To use this command, pass in the command and arguments you want to execute, as in: sudo vi /etc/hostconfig. You'll need to be a user with Administrative privileges. The main user has this capability by default.

If you need a root shell, you can always use sudo tcsh or sudo bash. If you want to enable the root user, it's as simple as giving root a password with sudo passwd root. You'll also want to open System Preferences, choose Accounts, then Login Options and change Display Login Windows as: to Name and password. Then you can log out and log in as the root user.

To get compilers and many other development tools, you'll need the Mac OS X Developer Tools. If you bought the boxed version of Mac OS X, the Developer Tools should be included on a separate CD-ROM. If you bought a new Macintosh that came with Mac OS X preinstalled, the Developer Tools installer will probably be in /Applications/Installers. Failing either of those, or if you'd like to get the latest version of the tools, they are available to Apple Developer Connection (ADC) members.

3. Startup

Mac OS X startup is nothing like other Unix systems. Most significantly, Mac OS X has nothing like the /etc/init.d directory. Instead, it finds its startup items via /System/Library/StartupItems (for system startup items) or /Library/StartupItems the launchd startup program. You can read all about it in this ADC article.

4. Filesystem Layout

If you open up a Finder window to the top-level of your hard drive, you'll see that familiar friends like /var and /usr are missing. They are actually hidden (more on that later). If you open up a Terminal shell and do an ls /, you'll see the missing folders, as well as a few others, such as /Library and /Developer.

The following table lists some of these folders that you'll see (Appendix A of Mac OS X for Unix Geeks contains a more comprehensive list):

File or Directory

Description

.DS_Store

This file contains Finder settings.

.Spotlight-V100

This file contains Spotlight settings.

.Trashes

This directory contains files that have been dragged to the Trash.

.fseventsd

Used by the File System events framework.

.hotfiles.btree

This is used by Mac OS X's Hot-File-Adaptive-Clustering feature to keep track of frequently used files.

.vol/

This directory maps HFS+ file IDs to files.

Applications/

This directory holds all your Mac OS X applications. Check out its Utilities/ subdirectory for lots of fun stuff!

Desktop DB, Desktop DF

The Classic Mac OS desktop database.

Desktop Folder/

The Mac OS 9 desktop folder.

Developer/

Apple's Developer Tools and documentation. Only available if you have installed the Developer Tools.

Library/

Support files for locally installed applications, among other things.

Network/

Network-mounted Application, Library, and Users directories, as well as a Servers directory.

Shared Items/

Use by Mac OS 9 to share items between users.

System Folder/

The Mac OS 9 System Folder.

System/

Contains support files for the system and system applications, among other things.

Temporary Items/

Temporary files used by Mac OS 9.

TheVolumeSettingsFolder/

This directory keeps track of details such as open windows and desktop printers.

Trash/

Mac OS 9 trash folder.

Users/

Home directories.

VM Storage

Mac OS 9 virtual memory file.

Volumes/

Contains all mounted filesystems.

automount/

This directory handles static NFS mounts.

bin/

Contains essential system binaries.

cores/

If core dumps are enabled (with tcsh's limit and bash/sh's ulimit commands), they will be created in this directory as core.pid.

dev/

This directory contains files that represent various devices.

etc/

This directory contains system configuration files.

mach

This is a symbolic link to the /mach.sym file.

mach.sym

Kernel symbols.

mach_kernel

The Darwin kernel.

private/

Contains the tmp, var, etc, and cores directories.

sbin/

Executables for system administration and configuration.

tmp/

Temporary files.

usr/

This directory contains BSD Unix applications and support files.

var/

This directory contains frequently modified files such as log files.

Pages: 1, 2

Next Pagearrow