How to Fix the Home and End Buttons for an External Keyboard in Mac


If you are a seasoned Mac user, you will know that the shortcut keys “Command + Left arrow” and “Command + Right arrow” move the cursor to the start and end of the line respectively. However, if you use a full-size external keyboard for your Mac, you will find that the “Home” and “End” buttons aren’t working properly. In fact, they are not working at all since Apple doesn’t bind the buttons to any function.

If you want to fix the “Home” and “End” buttons, here is a quick tip to get them working again the way they should.

1. Open a terminal. You can access it from the Launchpad.

2. Type the following commands (and press Enter after each line):

cd ~/Library
mkdir KeyBindings
cd KeyBindings
nano DefaultKeyBinding.dict

What the above commands do is create a new “KeyBindings” folder in the “Library” folder and add a new “DefaultKeyBinding.dict” file.

3. In the text editor that opens, copy and paste the following commands to it:

/* Remap Home / End keys */
/* Home Button*/
"\UF729" = "moveToBeginningOfLine:"; 
/* End Button */
"\UF72B" = "moveToEndOfLine:"; 
/* Shift + Home Button */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; 
/* Shift + End Button */
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; 
/* Ctrl + Home Button */
"^\UF729" = "moveToBeginningOfDocument:"; 
/* Ctrl + End Button */
"^\UF72B" = "moveToEndOfDocument:"; 
 /* Shift + Ctrl + Home Button */
"$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:";
/* Shift + Ctrl + End Button*/
"$^\UF72B" = "moveToEndOfDocumentAndModifySelection:"; 

Save (using shortcut “Ctrl + o”) and exit (“Ctrl + x”) the file.

4. Restart your Mac. The “Home” and “End” should be working now, and you can use it in conjunction with the “Shift” and “Ctrl” modifier buttons.


Damien Oh started writing tech articles since 2007 and has over 10 years of experience in the tech industry. He is proficient in Windows, Linux, Mac, Android and iOS, and worked as a part time WordPress Developer. He is currently the owner and Editor-in-Chief of Make Tech Easier.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox