Switching to MacOS after decades on Windows and Linux felt strange in many places. Things work somehow, but not quite how you expect.

One of the first oddities I ran into was the keyboard mapping. Not Talking about CTRL-ALT-META-CMD stuff, this is a whole “getting used to” learning curve on it’s own. But if you’re using a regular “IBM PC” layout which is mostly identical on Windows and Linux Desktop, on macOS some keys act… unpredictable. Specifically, Home and End keys don’t do what you would expect them to do. Instead of jumping to the start or end of a line, they scroll entire documents or behave differently depending on the app. In editors like VS Code? No problem, they work fine. But TextEdit, Office or some others and suddenly they behave totally different.

For someone who types a lot, that quickly gets annoying. Maybe I’m just to old to throw 30yrs+ PC “muscel memory training” off the cliff. The good news is you don’t need fancy third-party apps to fix it. MacOS already has a simple way to remap keys through a plain text config file. It takes a few minutes, and after that, your keyboard will finally behave the way your fingers expect.

The Problem with Home and End on MacOS

By default, MacOS treats Home and End as document navigation keys, Home jumps to the top of a file, End to the bottom. That’s fine for browsing, but if you’re editing code or text line-by-line, it’s not what you want.

If you’re used to Windows or Linux, you probably expect these shortcuts:

  • Home > Move to the start of the line
  • End > Move to the end of the line
  • Ctrl+Home > Jump to the start of the document
  • Ctrl+End > Jump to the end of the document
  • Add Shift to select text along the way

Without some tweaks, MacOS doesn’t handle these consistently.

Lets fix that.

Step-by-Step: Create a DefaultKeyBinding.dict

MacOS lets you override key behavior with a file called DefaultKeyBinding.dict inside your Library folder.

  1. Open Finder and press SHIFT + CMD + G to bring up “Go to Folder”
  2. Type ~/Library and hit Enter.
  3. Look for a folder named KeyBindings. If it doesn’t exist, create one.
  4. Create a new text file named DefaultKeyBinding.dict inside that folder.
  5. Paste this in:
 {
 /* Remap Home / End keys to be correct */
 "\UF729" = "moveToBeginningOfLine:"; /* Home */
 "\UF72B" = "moveToEndOfLine:"; /* End */
 "$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
 "$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */
 "^\UF729" = "moveToBeginningOfDocument:"; /* Ctrl + Home */
 "^\UF72B" = "moveToEndOfDocument:"; /* Ctrl + End */
 "$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; /* Shift + Ctrl + Home */
 "$^\UF72B" = "moveToEndOfDocumentAndModifySelection:"; /* Shift + Ctrl + End */
 }
  1. Save the file, close your editor, and reboot your Mac.
  2. After logging back in, open something like TextEdit.
    Type a few lines of text and test the keys. They should now move within the current line instead of jumping around like before.

These changes work across most apps. A few might ignore them (mostly non-native ones), but this solves the problem for the majority.

After this tweak, my non-Apple keyboard suddenly felt right again. It’s a small fix, but it smooths out that weird disconnect you get when switching between systems.