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):

sudo bash 
mkdir -p ~/Library/KeyBindings ; cd ~/Library/KeyBindings
vim 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 the 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.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store