Mac OS X

I have sometimes no alternatives but using Mac/Intel computers. In this page, I try to list some random tricks to make them somehow more usable.

Table Of Contents

  1. Keyboard Shortcuts
  2. Scheduling with launchd
  3. Safe-sleep
  4. cdrtools

Keyboard Shortcuts

A table with more shortcuts than I could ever know:
However, below are some shortcuts which seem to miss in this table.

fn command F1 | fn command F2
Detect displays.
fn option F1 | fn option F2
Open System Preferences/Displays.
fn option F3 | fn option F4
Open System Preferences/Sound.

A table of symbols used to pretty-print hotkeys in Mac OS X:
I began to write a table with Unicode code point but such tables have already been done elsewhere. Besides some symbols (the upwards white arrow ⇧ for example) seems to be not rendered properly, sometimes, with Firefox on Mac OS X Tiger but I always see them perfectly on Safari... or with Firefox on Ubuntu!

Hotkey symbols
Symbol Unicode code point Key
U+2325 OPTION KEY Option key (alt)
U+2318 PLACE OF INTEREST SIGN Command key (Apple key)
U+2303 UP ARROWHEAD Control key
U+232B ERASE TO THE LEFT Backspace

An article to set up decent keybindings for Cocoa text fields:
Customize the Cocoa text binding system
Playing with Cocoa keybindings customization capabilities this article describes, I wrote a small Perl script which acts as a filter from Unix Compose files supplied on standard input to Cocoa KeyBindings plist returned on standard output. The key which Compose is mapped to is hard-coded in a variable at the beginning of the script; by default, the Enter key (⌅) is used. It could be more usefull to produce new keymaps to target non-Cocoa applications as well, but that will be for another day!

Scheduling with launchd

Each job scheduled by launchd is defined in a plist. Parameters of such plist are documented in the launchd.plist(5) man page. To create a new job my_new_job.plist in the current directory:

$ defaults write $PWD/my_new_job Label "My new job"
"My new job" is the key which uniquely identifies the job to launchd.
$ defaults write $PWD/my_new_job ProgramArguments -array sh "-c" '"fetchmail > /dev/null 2>&1"'
Specifies the command-line to run.
$ defaults write $PWD/my_new_job StartCalendarInterval -dict Hour -int 21 Minute -int 45
The job will be launched every day at 9:45pm. Minute, Hour, Day, Weekday (0 and 7 are Sunday), Month may be fixed, or left as wildcards.
$ launchctl load $PWD/my_new_job.plist
Register the job.
$ launchctl unload $PWD/my_new_job.plist
Unregister it.


By default, only regular sleep (suspend-to-ram) was enabled in the version of the MacBook I use. Two command-lines to enable safe-sleep (traditionally referred as suspend-to-disk or hibernation):

$ sudo nvram nvramrc='" /" select-dev
" msh" encode-string " has-safe-sleep" property
$ sudo nvram "use-nvramrc?"=true

Changes are applied after rebooting. The hibernatemode option in power management settings selects the suspend policy:

$ sudo pmset -a hibernatemode 0
always regular sleep (disable safe-sleep)
$ sudo pmset -a hibernatemode 1
always safe-sleep (disable regular sleep)
$ sudo pmset -a hibernatemode 3
regular sleep first, safe-sleep if the battery is very low on power or is unplugged
$ sudo pmset -a hibernatemode 5
always safe-sleep with secure virtual memory
$ sudo pmset -a hibernatemode 7
regular sleep first then safe-sleep with secure virtual memory

The following applescript puts the mac to sleep: tell application "System Events" to sleep. The sleep command turns out to be in the Finder's dictionary too.


cdrtools is packaged in MacPorts. My Mac automatically mounts CD-roms as soon as I insert them: I unmount them with a diskutil unmount /dev/disk1. According to this site, IOCompactDiscServices or IODVDServices may be used whether the Mac has got a mere CD-Rom drive or a CD/DVD combo-drive. Therefore I put:


in /etc/default/cdrecord file.