The Mac Terminal.app is one of the best Terminals I have used, but it has some annoying quirks like not supporting standard key definitions out of the box. The most frustrating ones are Home and End.
In nearly every OS, Home has meant “go to the beginning of the line” and End has meant “go to the end of the line,” but on the Mac, the default has always been for Home to scroll a document up to the top and for End to scroll the document down to the bottom.
However, since most Terminal applications aim for the Unixy world, they don’t care about scrolling through documents as much as dealing with the line you are on.
Luckily, the Mac Terminal has the ability to let the intrepid user customize it’s keybindings. If you want to make your Terminal operate like a standard Unix-like terminal, follow these simple steps:
- Open the Terminal app.
- Select Preferences from the Terminal Menu.
- Under Settings, select a Profile you want to change.
- In the right pane, select the Keyboard button to see keyboard settings.
- Select the line that has the word “home” in the “Key” column.
- Click the Edit Button at the bottom.
- Make it look like this:
- To enter the right key code, clear the box and type these keys in order: ESCAPE O H (that’s a capital letter o, not a zero)
- The right key code for “end” is exactly like “home” but you replace the “H” with an “F”.
Some Linux/Unix Friendly Keycodes (submit your own in the comments):
- home ::
- end ::
- F1 ::
- F2 ::
- F3 ::
- F4 ::
Other links that worked but had problems:
The main problem with each solution below is that they only work part of the time. My solution above is compatible with the latest version of Mac OS X (Mountain Lion), and is also the default key binding for xterm, remote shells (ssh), vi(m), and also GNU screen. Each of the solutions below only work in a few of the cases for me.