This page is now out of date.

The current version is here.

You will be redirected in 15 seconds

Ted's Macintosh Tips and Tricks

This is a list of software and information that has been useful to me as I've moved over to Mac OS X. I hope that you find it useful as well.

Software

Utilities

Applications

Self Expression/Customization

Screensavers

Other customizations

Built in apps

Unix compatibility

Tips and Info

System wide Emacs keybindings
The Cocoa Text Input system allows you to bind text editing commands to keystroke by placing them in a file. gnufoo, todbot and Misaka describe how to use this capability to get Emacs like keybindings in most Mac OS X text widgets. I am using Misaka's keybindings. These bindings use TextExtras, and I've included the completion fix described by macosxhints. TextExtras allows you to do all kinds of neat stuff in a text widget, such as run a shell script, complete based on other words in the widget, etc.

Firefox doesn't use native widgets, so this doesn't work in Firefox widgets. Todbot describes how to do Emacs like bindings for Firefox

If you want vi style keys, look at this page.

Command Line interface to the Address Book
I don't make any apologies about being a shell guy, so I like to have command line tools for as much as possible. contacts lets you access the Mac OS X Address Book from the command line.

say
One of the nice things about Mac OS X is that you have easy access to speech synthesis. This is useful for all kinds of notifications. Many of the Mac applications can take advantage of this. The say command lets shell scripts (and any program that can exec other programs) have access to the speech syntesizer as well. man say for the details. I use say at the end of long running commands to let me know that the run has finished.

Command line battery capacity, power manager
Here are some ways to deal with a powerbook's battery and power management from the command line. You can use the battery script to get information about the status of your battery. If you are a hard core command line geek, or using somebody else's powerbook, you can do: ioreg -l | grep -i IOBatteryInfo.

The built in command pmset lets you display and modify the power management settings.

Look here for more 15" Powerbook battery info

Controlling NVRAM settings
The nvram command lets you modify the Open Firmware Non-Volatile RAM settings. I used this to make my boot sequence more UNIX like (console w/ scrolling UNIX stuff) by doing sudo nvram boot-args="-v"

Dealing with the Clipboard from the command line
Thanks to Wilhelm Fitzpatrick for this one. You can use the commands pbcopy and pbpaste to manipulate the clipboard from the shell or a shell script.
Manipulating services
The /sbin/service command will let you enable and disable services from the command line

What should I set JAVA_HOME to?
Apple's Java is a different place that non Mac Java developers will have a hard time finding. Set JAVA_HOME=/Library/Java/Home

lookupd
Mac OS X runs lookupd which caches all kinds of network related information, most notably DNS entries (no need to run a caching bind to get this). If you need to flush the lookupd cache for some reason, do sudo lookupd -flushcache

CUPS tricks
Mac OS X uses CUPS to manage printing. You can get to the CUPS control panel via http://127.0.0.1:631/.

I have a duplexing HP LaserJet 2200dtn. In order to get lpr to do duplexing, I had to do lpoptions -p <printer-name> -o sides=two-sided-long-edge. In order to get lpr to recognize the name of the printer (it's connected over Ethernet via TCP/IP), I had to muck with entries in /etc/cups/printers.conf and I had to copy/rename ppds i /etc/cups/ppd. It was no fun, but it works.

Repairing disk permissions from the shell
To repair disk permissions from the shell use: sudo diskutil repairPermissions /

Updating prebinding from the shell
I understand the concept behind prebinding, but not the implementation. If you feel that you need to update your prebindings, you can do sudo update_prebinding -root / -force. I did this once and my system acted very weird afterwards. I probably won't do it again.

Automatically loading ~/Library/Java/Extensions
Mac OS X automatically loads jars from the directory ~/Library/Java/Extensions. Whether this is a good thing or a bad thing is up for debate.

~/Applications
This one is a personal preference. I've installed most of my applications to a ~/Applications directory instead of /Applications.

A bug in Apple Perl 5.8.1
There is a bug in the version of perl 5.8.1 shipped with OS X. In order to get some modules to load, you need to do this:

sudo vi /System/Library/Perl/5.8.1/darwin-thread-multi-2level/Config.pm

Change ld='MACOSX_DEVELOPMENT_TARGET=10.3 cc' to ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc'

[ via ] MacZealots

readline support for Apple Python
Due to a conflict with readline's licensing under the GPL, the Python 2.3 shipped on Panther is missing readline support, which you just plain need in the interactive interpreter. Bill Bumgarner shows how to get it installed

Making Mail.app work with a self signed SSL certificate
This Apple KB article describes how to use a self signed certificate in Mail.app without it asking you about the certificate each time. In step 3 where they say drag the certificate on top of KeyChain Access, they mean the KeyChain Access should not be running, and that you drop the certificate icon on top of the icon in /Applications/Utilities

Enhancing the Panther Calculator
The Panther Calculator ships with a bunch of hidden views. Macintouch reader Norman Palardy describes how to enable them. Search for his name to get the information.

An rm that uses the Mac OS X Trash
For those who engage the fingers before the brain (like me). Use the rmm script to get remove files to ~/.Trash rather than killing them.

Lookup Carbon Error codes from the command line
On Mac OS 7/8 there was a nice desk accessory that let you look up various Macintosh error codes. This MacOSXHints article describes a variety of ways to do this lookup from the Shell on Mac OS X. I ended up using the perl version at the end. If you know of an unobtrusive GUI version let me know.

Automounting SAMBA shares
I have a few of Linux boxes lying around the house doing duty as webservers and so on. Because we used to be a Windows household, each of those servers exports directories as SAMBA shares. I'm not really interested in setting up NFS (although maybe I should -- but then I'd probably want AFS or CODA), so I just want a way for those shares to get mounted when I log in or when the powerbook wakes up. It turns out that this is harder than it ought to be.

You can mount shares in the Finder via Applescript code that looks like this:

tell application "Finder"
    try
    	mount volume "smb://WORKGROUP;username:password@machine_name/directory"
    end try
end tell

Automounting of shares in /Network is controlled by NetInfo -- you have to use the NetInfo Manager as described in this article. You need to supply a SAMBA url instead of an AFP url.

You can also mount using a shell script.

#!/bin/bash
mount_smbfs //username:password@server1/home ./s1home
You also want to unmount them when you go away / lid close

You can unmount non local volumes in Applescript like this:

tell application "Finder"
	eject (every disk whose local volume is false)
end tell
Running shell scripts at login and logout
Note that this is different from running the .profile or equivalent files, since they apply to shells started in Terminal, iTerm or the PathFinder terminal, etc. These scripts are executed when you login and logout of OS X. Mike Bombich, author of Carbon Copy Cloner (which I haven't tried yet) has a pointer to doing it exclusively via the command line, or by using his free LoginWindow Manager program. This would be a good place to mount and unmount shares, etc.
Viewing any number of individual days in iCal
[Via macosxhints.com] Press Command-Option-{2,3,4,6} to view 2,3,4, or 6 days. Command-Option-5 shows the 5 day week and Command-Option-7 shows the 7 day week
Virtual Hosts and mod_rendezvous_apple
This article tells how to setup virtual hosts so that Apple's mod_rendezvous will show each virtual host. Rendezvous access to websites is great for conferences and other ad-hoc in person networking situations, as well as mobile work groups. I wish that Firefox had this.
Quit Mac apps from the shell
Command line http://www.macosxhints.com/article.php?story=20040623231530448 to quit applications. I'm using the nice zsh functions.
Easier command line Mac app launching
Shell script to make it easier to launch Mac apps from the command line
Tell Mail.app to send a message on a schedule
Andreas Amann's Mail Scripts, a set of AppleScripts to make Mail.app do various cool things. The one I like the most is Schedule Delivery.
Getting to hidden folders in open/save dialogs
You need to know how to do this!
Using iChat to send SMS's to a cell phone
The advantage of doing this is that the SMS reply goes to the iChat window, not your e-mail mbox
How to launch a GUI app as root
If you must, you must
Nicer separators for Safari Bookmarks
I'm using Safari a bit more
Rebuilding the Launch Services Database
These sorts of hints remind me of Windows...
How to solve Mail.app index problems
Because Mail.app does hang/crash.
Getting to the console from the login panel
This is handy when troubleshooting your machine
You can pipe the output of a shell command to "open -f" to get that output into TextEdit [via Macworld 10/2004 p. 87 ]
Some of this type of stuff can be done with Quicksilver
Docklet folders
Put commonly used folders into the dock for easy access
Turn on the Safari Debug Menu
There are a few useful items in the Debug menu - like import/export of bookmarks

Good Resources