You are previewing Mac OS X Hacks.
O'Reilly logo
Mac OS X Hacks

Book Description

Mac OS X is a marvelous confluence of the user-friendly and highly customizable Macintosh of yesteryear and the power and flexibility of Unix under the hood. Those coming to Mac OS X from previous incarnations of the operating system recognize much of the friendly face of the Macintosh but they are also plunged into a whole new world. Unix converts to Mac OS X find a familiar FreeBSD-like operating system at the core and many of the command-line applications that they're familiar with. This presents a unique opportunity for combining traditional Unix hacking and Mac OS know-how. Mac OS X Hacks goes beyond the peculiar mix of man pages and not-particularly-helpful Help Center, pulling the best tips, tricks, and tools from the Mac power users and Unix hackers themselves. The collection reflects the real-world know how and experience of those well steeped in Unix history and expertise, sharing their no-nonsense, sometimes quick-and-dirty solutions to administering and taking full advantage of everything a Unix desktop has to offer: Web, Mail, and FTP serving, security services, SSH, Perl and shell scripting, compiling, configuring, scheduling, networking, and hacking. Add to that the experience of die-hard Macintosh users, customizing and modifying their hardware and software to meet their needs: System Preferences, GUI mods and tweaks, hardware tips, vital shareware and freeware, AppleScript, AppleTalk and equivalents, keyboard modifiers, and general Macintosh-style tomfoolery. Each Hack can be read easily in a few minutes, saving countless hours of searching for the right answer. Mac OS X Hacks provides direct, hands-on solutions that can be applied to the challenges facing both those meeting the Mac for the first time and long-time users delving into Mac OS X and its Unix underpinnings. Mac OS X Hacks is the third in O'Reilly's new Hacks Serier which aims to begin reclaiming the term "hacking" for the good guys. In recent years, the term has come to be associated with those nefarious black hats who break into computers to snoop, steal information or disrupt Internet traffic. But the term originally had a more benign meaning, and you'll still hear it used this way whenever developers get together. Our new Hacks books are written in the spirit of the true hackers -- the people who drive innovation.

Table of Contents

  1. Mac OS X Hacks
    1. Credits
      1. About the Authors
      2. Contributors
      3. Acknowledgments
        1. Rael
        2. Kevin
    2. Foreword
    3. Preface
      1. How to Use This Book
      2. How This Book Is Organized
      3. Conventions Used in This Book
      4. How to Contact Us
    4. 1. Files
      1. Hacks #1-12
      2. Understanding and Hacking Your User Account
        1. What’s in a Name?
        2. Your Home Directory
        3. Who’s the Boss?
        4. Renaming an Account
        5. Deleting an Account
      3. Taking the Bite Out of Backup
        1. .Mac’s Backup
        2. psync
        3. psyncX
          1. Backing up
          2. Testing backup
          3. Remote backup
          4. Restoring from backup
        4. See Also
      4. Backing Up on the Go
        1. Backup as Part of .Mac Membership
        2. AirPort, Unwiring Backup
        3. Using Other Media Too
        4. The Cost of Protection
        5. Final Thoughts
      5. Dealing with Archives of Many Colors: .img, .sit, .tar, .gz
        1. .dmg and .img
        2. bzip2
        3. Other Compression Techniques
        4. Don’t Forget Stuffit
      6. A Line Break Is a Line Break
      7. Fiddling with Type/Creator Codes and File Extensions
        1. See Also
      8. Locking and Unlocking Files
        1. See Also
      9. Stubborn Trash, Stuck Images, and Jammed CDs
        1. Stubborn Trash
          1. In use
          2. Locked
          3. Permissions
          4. rm
        2. Stuck Image
        3. Jammed CD/DVD
      10. Aliases, Symlinks, and Hard Links
      11. Recent Filenames
      12. Inspecting the Contents of an .app Package
      13. Opening Microsoft Word Documents Without Microsoft Word
    5. 2. Startup
      1. Hacks #13-17
      2. Getting a Glimpse of the Boot Process
        1. See Also
      3. Booting from Another Device
      4. Turning Your Mac into a Hard Drive
      5. Using Open Firmware Password Protection
        1. Hacking the Hack
        2. See Also
      6. OS X for This Old Mac
    6. 3. Multimedia and the iApps
      1. Hacks #18-32
      2. Top iChat Tips
        1. Into the Well
        2. Rendezvous
        3. File Transfer
        4. Screenshot Sharing
        5. Whereabouts
        6. Chatrooms
        7. Buddies
        8. Logs
      3. AIM Alternatives
      4. Printing to PDF or Bitmapped Image
      5. Image Conversion in a Pinch
        1. Preview
        2. iPhoto
        3. Graphic Converter
        4. More
      6. Top 10 iPhoto Tips
        1. Data In: Taking Better Pictures
          1. Tip #1: Buy a bigger memory card for your camera.
          2. Tip #2: Shoot at your camera’s highest resolution.
          3. Tip #3: Get closer.
          4. Tip #4: Find the fill flash setting and use it.
          5. Tip #5: Avoid red eye when possible.
        2. Data Out: Managing iPhoto Files
          1. Tip #6: Limit library size to 650MBs.
          2. Tip #7: Use iPhoto Library Manager to switch between libraries.
          3. Tip #8: Create custom albums for better organization and retrieval.
          4. Tip #9: Duplicate photos before editing.
          5. Tip #10: Add titles to important photos.
      7. Make Your Own Documentary
        1. What You’ll Need
        2. Photos and Music
        3. Image Prep
        4. Storyboard
        5. Photo to Movie
        6. Advanced Options
        7. Narration
        8. iMovie, You Movie
        9. Transitions
        10. Can I Have the Envelope, Please?
        11. See Also
      8. From Slideshow to Video Presentation
        1. Using Just One Leg of a Three-Legged Stool
        2. Get Your Toolbox in Order
        3. How the iApps Can Work Together
          1. iTunes
          2. iPhoto
        4. Working Example: Use iMovie and iTunes to Add Professional Touches to Your Still Images
          1. Create opening titles in iMovie
          2. Fine-tune your music track
        5. Pulling It All Together
      9. Hijacking Audio from Mac Apps
      10. Running Your Own Web Radio Station
        1. Step 1: Calculate Bandwidth
        2. Step 2: Install/Configure QuickTime Streaming Server
        3. Step 3: Create a Promotional Spot
        4. Step 4: QTSS General Settings
        5. Step 5: Build a Playlist
        6. Step 6: Finish Up
        7. Step 7: Tune In
        8. Step 8: Administer Remotely
        9. Step 9: Getting Help
      11. Sharing Your Listening Preferences
      12. Controlling iTunes with Perl
        1. iTunes Is AppleScriptable
        2. iTunes and Perl
        3. iTunes, Perl, and Terminal
        4. iTunes, Perl, and Apache
        5. iTunes, Perl, Apache, and mod_perl
        6. iTunes, Perl, and Tk
        7. Final Thoughts
      13. iCal Calling iTunes
        1. See Also
      14. Publishing and Subscribing to iCal Calendars
        1. Publishing
        2. Subscribing
      15. Using Bluetooth for SMS and Phone-Call Handling
        1. Pairing Up Your Phone with Address Book
        2. Sending SMS Messages
        3. Receiving SMS Messages
        4. Handling Incoming Calls
        5. Saving Incoming Messages
      16. iSync via Bluetooth
        1. Installing iSync
        2. Adding the T68 Using Bluetooth
        3. Adding the Palm m515
    7. 4. The User Interface
      1. Hacks #33-47
      2. Finding Your Way Back to the Desktop
      3. Alt-Tab Alt-Ternatives
      4. Putting Things in the Apple Menu
      5. Keeping Your Snippets Organized
        1. Launcher Drawer
        2. Processes Drawer
        3. Creating More Drawers
        4. Everything’s Active and Configurable
      6. LaunchBar, a Dock Alternative
      7. DockSwap, Another Dock Alternative
      8. Tinkering with Your User Interface
        1. Dock Position
        2. Removing Arrows
        3. Displaying Multiple Lines of a Filename
        4. Shadowing the Dock
        5. Changing the System Fonts
      9. Extending Your Screen Real Estate with Virtual Desktops
        1. CodeTek VirtualDesktop
        2. Project Space.app
      10. Top Screenshot Tips
        1. Built-Ins
        2. Grab
        3. Using Snapz Pro X
        4. Screen Capture with Terminal
      11. Checking Your Mac’s Pulse
      12. Screensaver as Desktop
      13. Dipping Your Pen into Inkwell
        1. Makes You Wonder . . .
      14. Speakable Web Services
        1. Perl and AppleScript Working Together
        2. Namespace Management
      15. Using AppleScript in Contextual Menus
      16. Prying the Chrome Off Cocoa Applications
        1. Installation
    8. 5. Unix and the Terminal
      1. Hacks #48-65
      2. Introducing the Terminal
        1. Launching the Terminal
        2. Current Working Directory
        3. List Files and Folders
        4. Clearing the Screen
        5. Changing Directories
        6. Moving On Up
        7. Creating Directories
        8. Removing Directories
        9. Copying Files
        10. Deleting Files
        11. Moving Files
        12. Viewing the Content of a Text File
        13. Copy and Paste, Drag and Drop
        14. Consulting the Manpages
        15. Getting Off the Command Line
      3. More Terminal Tricks and Tips
        1. Customizing Your Terminal
        2. Switching Terminal Windows
        3. Learning from History
        4. Listing All the Commands
        5. Changing Permissions with chmod
        6. Changing Owner and Group with chown and chgrp
        7. Counting Files
        8. Displaying a Calendar
      4. Becoming an Administrator for a Moment
        1. Desktop Root
        2. Command-Line Root
        3. Enabling the Root Account
        4. Logging in as Root
      5. Editing Special Unix Files
        1. Using pico
          1. Moving about
          2. Saving
          3. Opening
          4. Selecting text
          5. Deleting
          6. Leaving
        2. TextEdit
        3. Setting Your Default Command-Line Editor
        4. Why Not Simply Go GUI?
      6. Setting Shell Environment Variables
        1. See Also
      7. Scheduling with System Tasks and Other Events
        1. The crontab File
        2. Your User crontab
        3. The System crontab
      8. Opening Things from the Command Line
      9. Introducing and Installing the Mac OS X Developer Tools
        1. Getting the Developer Tools
        2. Installing the Developer Tools
        3. Removing the Developer Tools
      10. Top 10 Mac OS X Tips for Unix Geeks
        1. 1. Where’s My Shell?
        2. 2. sudo, Not su
        3. 3. Startup
        4. 4. Filesystem Layout
        5. 5. Different Kinds of Hidden Files
        6. 6. Aliases and Links
        7. 7. X11
        8. 8. Fink
        9. 9. /etc Is Not Always in Charge
        10. 10. Shutdown Doesn’t Really
      11. Turning a Command-Line Script into an Application
        1. Options
        2. Services
        3. See Also
      12. Installing Unix Applications with Fink
      13. Mirroring Files and Directories with rsync
      14. Using CVS to Manage Data on Multiple Machines
        1. What Is CVS?
        2. Using CVS
        3. Creating the Repository
        4. The First Checkout
        5. Identifying Binary Files
        6. Checking Out on Remote Machines
        7. Day-to-Day Use
          1. Adding files
          2. Removing files
        8. See Also
      15. Downloading Files from the Command Line
      16. Software Update on the Command Line
        1. Software Update CLI Walk-Through
        2. Snooping About
      17. Interacting with the Unix Shell from AppleScript
      18. Running AppleScripts on a Regular Basis Automatically
      19. Running Linux on an iBook
        1. The Decision
        2. Partitioning and Bootstrapping
        3. Installing Debian
          1. Getting AirPort to take off
          2. Installing a new kernel
          3. Every silver lining . . .
        4. Handy Toys
          1. Power management
          2. Special keys
          3. Hot plugging
        5. The Verdict
    9. 6. Networking
      1. Hacks #66-78
      2. Anatomy of an Internet Shortcut
        1. Editing an Internet Shortcut
        2. Creating an Internet Shortcut
      3. Renewing Your DHCP-Assigned IP address
      4. Sharing an Internet Connection
        1. Internet Sharing
        2. See Also
      5. Creating a One-Wire Network
        1. One-Wire Rendezvous
        2. One-FireWire Network
      6. Secure Tunneling with VPN or SSH
        1. Tunneling Data Over SSH
      7. Remotely Log In to Another Machine via SSH
        1. Introducing SSH
        2. Allowing Remote Login
        3. Getting from Here to There
        4. Copying Files over SSH
        5. Port Forwarding
        6. Remote Reboot
        7. Remote Screenshot
        8. SSH Without Passwords
      8. Running Windows on and from a Mac
        1. Virtual PC
        2. Virtual PC and RDC Performance
        3. Our Verdict
      9. Sharing Files Between Mac and Windows PCs
        1. Systems Configuration
        2. Viewing PC Files from a Mac
        3. Viewing Mac Files from a PC
      10. Mounting a WebDAV Share
        1. Connecting and Mounting
        2. Disconnecting
      11. Mounting a Remote FTP Directory
        1. Mounting Anonymous FTP Shares
        2. Mounting Authenticated FTP Shares
        3. Disconnecting
        4. Enabling Remote FTP Access
      12. Exchanging a File via Bluetooth
        1. Sending a File
        2. Receiving Files
        3. Ericsson Client for Phone
      13. Using Your Cell Phone as a Bluetooth Modem
        1. See Also
      14. Setting Up Domain Name Service
        1. Get a Static Address
        2. A Better Idea
        3. How Does This Help Me?
        4. Setting Up the Client
    10. 7. Email
      1. Hacks #79-84
      2. Taming the Entourage Database
        1. Back Up the Database
        2. Thin Out and Delete
        3. Rebuild the Database
        4. Final Thoughts
      3. Using IMAP with Apple’s Mail Application
        1. Checking for IMAP Service
        2. Creating an IMAP Mail Account
        3. Specifying Account Options
          1. Account directory
          2. IMAP path prefix
          3. Message caching
        4. Mac.com Accounts
        5. Organizing Mailboxes
          1. Inbox
          2. Creating and editing IMAP mailboxes
          3. Special mailboxes
        6. Organizing Messages
        7. Message Flags
          1. Recent
          2. Seen
          3. Answered
          4. Flagged
          5. Draft
          6. Deleted
        8. Deleting Messages
      4. Setting Up IMAP and POP Mail Servers
        1. Download and Build the IMAP Server
        2. Configure the Servers
      5. Getting sendmail Up and Running
        1. Hacking the hostconfig File
        2. On Permissions and Blame
        3. Working with Configuration Files
        4. A Script to Simplify Your Life
        5. Back to DontBlameSendmail
        6. Telling sendmail Which Hostnames Are Valid
        7. Setting Up the LUSER_RELAY
        8. Allowing Relaying from Certain Hosts
        9. Our Helper Script Expanded
        10. Running Behind a Firewall
        11. Working with Lame ISPs
        12. Getting NetInfo Out of the Picture
      6. Downloading POP Mail with fetchmail
      7. Creating Mail Aliases
    11. 8. The Web
      1. Hacks #85-98
      2. Searching the Internet from Your Desktop
        1. Searchling
        2. Huevos
        3. SearchGoogle.service
        4. Watson
        5. Sherlock
        6. Hacking Your Browser
        7. How Lazy Can You Get?
      3. Saving Web Pages for Offline Reading
      4. Reading Syndicated Online Content
        1. News Aggregators
        2. NetNewsWire
        3. Housekeeping
      5. Serving Up a Web Site with the Built-In Apache Server
        1. User Sites
        2. Behind the Scenes: the Configuration Files
      6. Editing the Apache Web Server’s Configuration
        1. Restarting Apache
        2. See Also
      7. Build Your Own Apache Server with mod_perl
        1. Preparation
        2. Building mod_perl
        3. Building Apache
        4. Testing Your New Apache Build
        5. Testing mod_perl
        6. Building libapreq
        7. Apache Startup Bundle
      8. AppleScript CGI with ACGI Dispatcher
        1. See Also
      9. Turning on CGI
        1. See Also
      10. Turning on PHP
      11. Turning on Server-Side Includes (SSI)
        1. See Also
      12. Turning on WebDAV
        1. Mac OS X and WebDAV
        2. Install the Apache mod_dav Module
        3. Configure WebDAV in Apache
        4. Setting Up Directories
        5. Creating Users
        6. Restart the Server
        7. See Also
      13. Controlling Web-Server Access by Hostname or IP Address
        1. See Also
      14. Controlling Web-Server Access by Username and Group
      15. Directory Aliasing, Indexing, and Autoindexing
        1. Aliases
        2. Directory Indexes
        3. Customizing the Directory Listing
    12. 9. Databases
      1. Hacks #99-100
      2. Installing the MySQL Database
        1. Installing the MySQL Package
        2. Compiling MySQL from Source
        3. Post-Installation Wrap Up
        4. Hello, MySQL!
        5. Two Minor Additions
      3. Installing the PostgreSQL Database
        1. Installation
        2. Setting Up a Database
        3. Accessing the Database
        4. See Also
    13. Index
    14. Colophon