Mac Howtos

Make alt work in Apple X11

Put the following in ~/.Xmodmap:

clear Mod1
clear Mod2
keycode 63 = Mode_switch
keycode 66 = Meta_L
add Mod1 = Meta_L
add Mod2 = Mode_switch

Restart X11. Then it will be possible to use alt+x for M-X in Emacs, etc.

Terminal.app

Fix Terminal's page-up and page-down keys

The defaults in the keyboard settings are as follows:

end scroll to end of buffer
home scroll to start of buffer
page down scroll to next page in buffer
page up scroll to previous page in buffer
shift end \033[F
shift home \033[H
shift page down \033[6~
shift page up \033[5~

This means that when you press (for instance) PageUp, it just moves up through the window’s scrollback, rather than sending a PageUp key to the application running the terminal. You have to use SHIFT+PageUp to actually tell the application to page up. This is the opposite way round to every other terminal I’ve ever used (of course, some don’t even have any scrollback to page through).

To fix this switch the shifted and unshifted pairs around as follows:

end \033[F
home \033[H
page down \033[6~
page up \033[5~
shift end scroll to end of buffer
shift home scroll to start of buffer
shift page down scroll to next page in buffer
shift page up scroll to previous page in buffer

Always Show Tabs In Terminal

Normally Terminal only shows the tab bar if there is more than one tab; a reasonable screen-space optimization for windows that never have more than one. But for a window that usually has tabs but occasionally doesn’t, the changing size when you temporarily go down to one window is annoying. So:

defaults write com.Apple.Terminal ShowTabBar 1

You will need to quit and restart Terminal. Set the default back to 0 to undo.

Suppress xterm when X11 starts up

I always have X11 running since I use a number of X11 applications. But by default it starts an xterm, which is futile and annoying since I use Terminal instead. Fortunately you can turn this off:

defaults write org.x.X11 app_to_run /usr/bin/true

Put your name in the login window

Anyone who steals your computer will probably wipe it before re-selling it, but in the event the police find it before they get around to it, this might help prove that it was stolen and/or speed its return to you.

sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "'Property of YOUR NAME <YOU@YOUR DOMAIN>'"

(Note the weird quoting!)

Choose the application that starts when you insert a memory card

OS X likes to start an application when you insert a memory card with photos on. Ideally this would be the one you’re going to use to import your pictures, rather than the default. Rather bizarrely this isn’t controlled through System Preferences.

(As far as I can tell you can’t do this with defaults.)

Command Line Tools

There are a number of useful command line tools, some of them the equivalents of GUI features.

Clipboard pbcopy, pbpaste
Spotlight mdfind, mdutil
Audio file format conversion afconvert
(afconvert -h is more informative than the man page)
Text file format conversion textutil (HTML, word, etc)
cupsfilter (convert anything to PDF)
Image file processing sips
Screenshot screencapture
Software package installer installer
Power settings pmset

RJK | Contents