You are previewing Mac OS X for Unix Geeks (Leopard), 4th Edition.
O'Reilly logo
Mac OS X for Unix Geeks (Leopard), 4th Edition

Book Description

If you're a developer or system administrator lured to Mac OS X because of its Unix roots, you'll quickly discover that performing Unix tasks on a Mac is different than what you're accustomed to. Mac OS X for Unix Geeks serves as a bridge between Apple's Darwin OS and the more traditional Unix systems. This clear, concise guide gives you a tour of Mac OS X's Unix shell in both Leopard and Tiger, and helps you find the facilities that replace or correspond to standard Unix utilities. You'll learn how to perform common Unix tasks in Mac OS X, such as using Directory Services instead of the standard Unix /etc/passwd and /etc/group, and you'll be able to compile code, link to libraries, and port Unix software using either Leopard and Tiger. This book teaches you to:

  • Navigate the Terminal and understand how it differs from an xterm

  • Use Open Directory (LDAP) and NetInfo as well as Directory Services

  • Compile your code with GCC 4

  • Port Unix programs to Mac OS X with Fink

  • Use MacPorts to install free/open source software

  • Search through metadata with Spotlight's command-line utilities

  • Build the Darwin kernel

And there's much more. Mac OS X for Unix Geeks is the ideal survival guide to tame the Unix side of Leopard and Tiger. If you're a Unix geek with an interest in Mac OS X, you'll soon find that this book is invaluable.

Table of Contents

  1. Special Upgrade Offer
  2. Preface
    1. Audience for This Book
    2. Organization of This Book
      1. Part I, Getting Around
      2. Part II, Building Applications
      3. Part III, Working with Packages
      4. Part IV, Serving and System Management
      5. Appendix
    3. Xcode Tools
    4. Where to Go for More Information
    5. Conventions Used in This Book
    6. Comments and Questions
    7. Safari® Books Online
    8. Acknowledgments from the Previous Editions
    9. Acknowledgments from Brian Jepson
    10. Acknowledgments from Ernest E. Rothman
    11. Acknowledgments from Rich Rosen
  3. I. Getting Around
    1. 1. Inside the Terminal
      1. Mac OS X Shells
      2. The Terminal and xterm Compared
      3. Using the Terminal
        1. Launching Terminal Windows
          1. Double-clickable shell scripts
        2. The Contextual Menu
      4. Customizing the Terminal
        1. Preferences
          1. Startup
          2. Settings
          3. Window groups
        2. Customizing the Terminal on the Fly
        3. Exporting and Importing Terminal Settings
          1. Saving Terminal settings in Mac OS X 10.4 Tiger
          2. Saving Terminal settings in Mac OS X 10.5 Leopard
      5. Working with File and Directory Names
        1. Tab Completion
        2. Changing Your Shell
      6. The Services Menu
      7. Bonjour
      8. Alternative Terminal Applications
      9. The open Command
    2. 2. Searching and Metadata
      1. Spotlight
        1. Performing Spotlight Searches
        2. Inspecting a File’s Attributes
        3. Managing Spotlight
      2. Apple’s Hiding Places for File Metadata
        1. Unix File System (UFS)
        2. Preserving Metadata
    3. 3. Files and Filesystems
      1. Sharing Files with Other Operating Systems
        1. Working with Bonjour
        2. Troubleshooting
      2. Files and Directories
        1. The Root Directory
        2. The /etc Directory
        3. The /dev Directory
        4. The /var Directory
        5. The /System/Library Directory
        6. The /Library Directory
    4. 4. Startup
      1. Booting Mac OS X
        1. The Boot Loader
        2. Initialization
        3. launchd
        4. SystemStarter
        5. Mach Bootstrap Services
      2. Creating Programs that Run Automatically
        1. Login Preferences
        2. SystemStarter
          1. The startup script
          2. The property list
        3. Launching with launchd
      3. Periodic Jobs
    5. 5. Directory Services
      1. Understanding Directory Services
      2. Configuring Directory Services
      3. Managing Directory Services Data
        1. Managing Users and Passwords from the Terminal
          1. Creating a user
          2. Creating a user’s home directory
          3. Granting administrative privileges
          4. Modifying a user
          5. Deleting a user
        2. Managing Groups
          1. Creating a group
          2. Adding users to a group
          3. Deleting a group
        3. Managing Hostnames and IP Addresses
          1. Creating a host
      4. Flat Files and Their Directory Services Counterparts
      5. Programming with Directory Services
        1. Working with Passwords
    6. 6. Printing
      1. AddPrinter
        1. Adding an IP Printer
        2. Creating a Desktop Icon for a Printer
        3. Modifying a Printer’s Settings
        4. Monitoring Printer Status and Troubleshooting
      2. Printer Sharing
      3. The Common Unix Printing System (CUPS)
        1. Printing from Remote Systems
          1. GNOME
          2. KDE
          3. Manual printer configuration (Linux and Unix)
          4. Printing from Linux
        2. Printing-Related Shell Commands
      4. Open Source Printer Drivers
        1. Gutenprint
        2. The HP InkJet Server (HPIJS) Project
    7. 7. The X Window System and VNC
      1. Installing X11
      2. Running X11
      3. Customizing X11
        1. Dot-Files, Desktops, and Window Managers
        2. X11 Preferences, Applications Menu, and Dock Menu
          1. Input
          2. Output
          3. Security
          4. Customizing X11’s Applications menu
      4. X11-Based Applications and Libraries
        1. X11 and the Rest of Mac OS X
        2. TKAqua
      5. Connecting to Other X Window Systems
        1. OSX2X
      6. Virtual Network Computing (VNC)
        1. Launching VNC
          1. VNC and SSH
        2. Connecting to the Mac OS X VNC Server
          1. X11-based VNC servers
          2. Aqua-based VNC servers
        3. Screen Sharing with iChat
        4. Restarting VNC Connections
    8. 8. Third-Party Tools and Applications
      1. Frontends for SSH and SFTP
        1. Cyberduck
        2. Fugu
        3. SSH Agent
      2. Mounting SSH Servers As Network Volumes
      3. TeX
        1. Installing MacTeX
        2. TeXShop
        3. LaTeXiT
      4. R with an Aqua GUI
      5. Open Source Replacements for Microsoft Office
      6. Video
        1. Open Source Video Players
      7. Image Editing
      8. 3D Modeling
    9. 9. Dual-Boot and Beyond
      1. Why Bother?
      2. Linux on Mac Hardware
        1. Partitioning for Linux
        2. Installation and Configuration
        3. Linux on Older Macs
        4. Mac-on-Linux
      3. Emulators on Mac OS X
        1. Getting a Linux Installation Disk Image
        2. Parallels
        3. VMware Fusion
        4. Virtual PC
        5. VirtualBox
        6. QEMU
  4. II. Building Applications
    1. 10. Compiling Source Code
      1. Compiler Differences
      2. Compiling Unix Source Code
        1. The First Line of Defense
        2. Host Type
          1. Macros
        3. Supported Languages
        4. Preprocessing
        5. Frameworks
          1. Framework structure
          2. Including a framework in your application
        6. Compiler Flags
      3. Architectural Issues
        1. Universal Binaries for Multiple Architectures
        2. AltiVec
        3. 64-Bit Computing
        4. Endianness
        5. Inline Assembly
      4. X11-Based Applications and Libraries
        1. Building X11-Based Applications and Libraries
        2. AquaTerm
    2. 11. Libraries, Headers, and Frameworks
      1. Header Files
        1. Precompiled Header Files
        2. malloc.h
        3. poll.h
        4. wchar.h and iconv.h
        5. dlfcn.h
        6. alloc.h
        7. lcyrpt.h and values.h
      2. The System Library: libSystem
      3. Shared Libraries Versus Loadable Modules
        1. Building a Shared Library
        2. Dynamically Loading Libraries
        3. Two-Level Namespaces
      4. Library Versions
      5. Creating and Linking Static Libraries
      6. Creating Frameworks
      7. Performance Tools and Debugging Tools
      8. CHUD Tools
      9. Interesting and Important Libraries
      10. Numerical Libraries
  5. III. Working with Packages
    1. 12. Fink
      1. Installing Fink
        1. Installing Fink from a Disk Image
        2. Installing Fink from Source
        3. Installing Fink from CVS
        4. Post-Installation Setup
      2. Using Fink
      3. FinkCommander
      4. Installing Binaries Using Command-Line Utilities
    2. 13. MacPorts
      1. Installing MacPorts
        1. Installing MacPorts from SVN
      2. Using MacPorts
        1. Creating and Installing Packages in .pkg Format
        2. Creating and Installing Packages in RPM Format
      3. MacPorts Maintenance
      4. Connecting to the MacPorts SVN Repository
      5. MacPort GUIs
        1. Porticus
        2. PortAuthority
    3. 14. Creating and Distributing Installable Software
      1. Using GNU tar
      2. Creating Disk Images
        1. Creating a Disk Image with Disk Utility
        2. Creating a Disk Image from the Command Line
        3. Distributing Your Image
          1. Internet-enabled disk images
      3. Using PackageMaker
        1. Setting Up the Directory
        2. Creating the Package
      4. Creating Fink Packages
        1. Creating and Publishing the Tarball
        2. Creating the .info File
        3. Installing the Package
      5. Creating MacPorts Packages
        1. Creating and Publishing the Tarball
        2. Creating the Portfile
        3. Building and Installing a Port
  6. IV. Serving and System Management
    1. 15. Using Mac OS X As a Server
      1. Built-in Services: The Sharing Preference Pane
        1. File Sharing
          1. Manual Samba configuration
          2. Manual FTP configuration
        2. Web Sharing
          1. dav_module (mod_dav)
          2. ssl_module (mod_ssl)
          3. php4_module (mod_php4)
          4. bonjour_module (mod_bonjour)
        3. Remote Login
        4. Screen Sharing and Remote Management
        5. Printer Sharing
        6. Internet Sharing
          1. ifconfig
          2. ipfw/natd
          3. bootpd
          4. named
        7. Xgrid Sharing
        8. DVD/CD Sharing
      2. The Email Server
        1. Configuring Postfix to Send Email
        2. Configuring Postfix to Receive Email
      3. The Mac OS X Firewall
        1. Manually Configuring ipfw
          1. Enabling firewall logging
          2. Enabling stealth mode
          3. Adding your own rules
      4. Free Database Servers on Mac OS X
        1. MySQL
          1. Compiling MySQL
          2. Installing MySQL
          3. Configuring MySQL
          4. Using MySQL
        2. PostgreSQL
          1. Compiling PostgreSQL
          2. Installing PostgreSQL
          3. Adding the startup item
          4. Configuring PostgreSQL
          5. Using PostgreSQL
        3. Database Support in PHP and Perl
      5. The Outside World
        1. Dynamic DNS
        2. Serving from Behind a Firewall
          1. Port mapping with an AirPort Base Station
    2. 16. System Management Tools
      1. Diagnostic Utilities
        1. top
        2. fs_usage
        3. lsof
        4. latency
        5. sc_usage
        6. vm_stat
      2. Kernel Utilities
        1. ddb
        2. DTrace
        3. Kernel Module Utilities
        4. sysctl
      3. System Configuration Utilities
        1. scutil
        2. defaults
        3. nvram
      4. Third-Party Applications
    3. 17. Other Programming Languages: Perl, Python, Ruby, and Java
      1. Perl for Mac OS X Geeks
        1. Mac::Carbon
        2. PerlObjCBridge.pm
        3. Mac::Glue
      2. Python for Mac OS X Geeks
        1. Carbon
        2. Appscript
        3. PyObjC
      3. Ruby and Rails for Mac OS X Geeks
      4. Java for Mac OS X Geeks
        1. Java Enterprise Edition (Java EE)
  7. A. Mac OS X GUI Primer
    1. Overview of the Aqua Desktop
    2. Making the Most of Your Desktop Space
      1. The Application Menu
      2. Exposé
      3. Spaces
  8. Index
  9. About the Authors
  10. Colophon
  11. Special Upgrade Offer
  12. Copyright