[SOLVED] Terminal.app Unicode problem v2: Alt+Space

Apparently, Alt+Space is another character than Space in Terminal.app. Both have the exact same representation but don’t have the same character code. I have no idea what it is useful for but it is annoying because I often hit it inadvertendly when using unix pipes.

The symptom is like that (where   is not shown in the terminal):

$ ls | grep x
-bash:  grep: command not found

This is because the character after the pipe is Alt+Space and not Space. I believe it is related to my previous entry. I’ll update the post if I find a solution.


For long, I have searched the existing keyboard layout to patch it, but didn’t find it. It turns out, it was much easier to create a new layout from an existing .keylayout. More infos below.

For the record, the Alt+Space character was the unicode no-break space

So here is how to fix your layout:

  1. Get Ukulele, the graphical keyboard layout editor
  2. Get an existing keyboard layout (in the Ukulele bundle or on the net)
  3. Put the .keylayout in “~/Library/Keyboard Layout” or in /Library and give it a new name.
  4. Open the .keylayout with Ukulele a. While pressing Alt, double-click the space bar. Replace the no-break-space by the space character. b. Set a keyboard name in Keyboard->Set Keyboard Name c. Save
  5. Log-off, relog.
  6. Go in System Settings->International->Layouts and select your new layout

For troubleshooting, see the Apple Installable Keyboard Layouts technical note.