HOW TO: Fix “Home” and “End” keys in the Mac Terminal

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:

Screen Shot 2013-08-23 at 10.46.57 AM

Some Linux/Unix Friendly Keycodes (submit your own in the comments):

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.

Written by:
Jeff Mikels Published on:
August 23, 2013 Thoughts:
11 Comments