HowTo: PC-Style keyboard mapping on Mac OS X (german keyboard)

The keymap on a german keyboard attached to a Mac is rather different that what people expect from a standard Linux or Windows PC. This is very irritating for novices and geeks at the same time. Especially if you program a lot you miss the braces and the brackets, but most of all you miss the backslash, the pipe symbol, the tilde and the AT symbol. Apple! How dare you! The backslash on a german keyboard is Alt+Shift+7! Argh!

Anyway, these days are over. Here is how to get a pretty standard PC-Style keymap alongside the old Apple bindings if possible:

1. mkdir ~/Library/KeyBindings (if it does not exist)
2. put the following text into the file Library/KeyBindings/DefaultKeyBinding.dict
3. Log out and log in (some apps like TextEdit pick up the changes directly when you restart them)

"\UF729" = "moveToBeginningOfLine:"; /* pos1 */
"^\UF729" = "moveToBeginningOfDocument:"; /* crtl + pos1 */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
"\UF72b" = "moveToEndOfLine:"; /* end */
"^\UF72B" = "moveToEndOfDocument:"; /* ctrl + end */
"$\UF72B" = "moveToEndOfLineAndModifySelection:";
"\UF72C" = "pageUp:";
"\UF72D" = "pageDown:";
"^~7" = ("insertText:", "|"); /* orig alt 7 */
"^~8" = ("insertText:", "{"); /* orig alt 8 */
"^~9" = ("insertText:", "}"); /* orig alt 9 */
"^\U00DF" = ("insertText:", "\U00BF");
"^+" = ("insertText:", "\U00B1");
"~<" = ("insertText:", "|");
"~7" = ("insertText:", "{");
"~0" = ("insertText:", "}");
"~8" = ("insertText:", "[");
"~9" = ("insertText:", "]");
"~+" = ("insertText:", "~");
"~\U00DF" = ("insertText:", "\U005C");
"~q" = ("insertText:", "@");
"^x" = "cut:";
"^c" = "copy:";
"^v" = "paste:";

This gives you the braces, the brackets, the backslash, the pipe symbol, the AT symbol, the tilde, Home/End on PC typical key combinations. It also gives Ctrl+X, C, V for cut/copy/paste in addition to Command+X, C, V. Most of the Apple key combinations still work after this change, so Mac users would still find their way in your system. The most noticeable change is Alt+7 for the pipe symbol which is now the opening brace.

I got all the info from this german page:

Tastaturbelegung unter Mac OS X

which provides a very useful example keymap (which I extended a bit above) and a link to this great page:


The latter one provides virtually all the background information you need to do your own keymaps.

Happy keymapping!

Change keyboard type button missing in System Preferences

After playing with the keyboard type (I don't remember exactly what I did) I had a nasty keyboard type/mapping problem on my MacBook Pro (Max OS X Leopard 10.5.1):

From some point on the two keys (<> and ^° in my case, german keyboard) where swapped. All other keys were normal, so it was not a keymap problem. The german keymap worked well except for these two keys which were swapped. Stangely enough the button to undo this change 'Change keyboard type ...' *vanished* from the System Preferences! I could not believe this until I verified that on other Macs this button is present. I don't understand why. Apple: Never do these configure once things!

Starting the KeyboardSetupAssistant did not help at all since it would say that all known keyboard were configured. Thanks.

I found the solution in some Apple forum thread but I am replicating it here since it took me quite some time to find it although it looks quite obvious to me now:

1) Delete the file: /Library/Preferences/com.apple.keyboardtype.plist
2) Restart

After removing the file and restarting:

1. I could set the keyboard type correctly using the assistant and
2. I can now change the keyboard type again using the System Preferences

I don't know why this button was missing before ...


Mac OS X 10.5.1 jnl: replay_journal: bad block list header

After a cold boot I reproducibly got into an infinite loop of the gray start screen. The boot-up sound would be played every 3 minutes continuously.

I pressed Apple-V to see what is going on and I got several messages indicating that the journalling on my root disk was corrupted:

jnl: replay_journal: bad block list header @ ...
jnl: journal_open: Error replaying the journal!
hfs: early jnl init: failed to open/create the journal (retval 0)

Booting in single user mode (Apple+S), doing an fsck -fy and an exit solved the problem temporarily. It would boot up without problems. But after a day and another cold reboot the problem was there again. My MacBook Pro would not boot and was stuck in the endless gray boot screen loop.

I think I now solved the problem by making it boot once (see above), then disabling the journal by doing

sudo diskutil disableJournal /dev/disk0s2

(This cannot be done in single user mode, you need to boot Mac OS X for this.)

Then I rebooted. No problem. Then I activated journalling using the disk utility and it works again. Rebooting cold now works fine. Let's see what the future brings.

But: Apple: Please. How hard can it be. Please make your stupid fsck program deal with such a situation instead of continuously rebooting. This is a showstopper bug for a lot of users. Filesystem checks must never assume the filesystem including any journal is OK!!! This is sounds rather obvious to me.