Update: There is now a version of KeyFixer for Firefox. Check it out.
A few months ago, I wrote a short article about how to fix the “home” and “end” keys in OS X. I published a step-by-step guide to adding your own custom key bindings via the command line. Many people found this too much of a pain, so I decided to make an easy clickable solution.
I wrote a quick shell script to copy a custom DefaultKeyBinding.dict into the current user’s Library folder. Then, with the help of Platypus, I made it a nice clickable application.
To fix your “home” and “end” keys (as well as “page up” and “page down”), just download and run KeyFixer. If you already have a DefaultKeyBinding.dict file, the script will exit without making any changes.
If you want to remove the changes that KeyFixer makes, just run the following command in Terminal.
rm ~/Library/KeyBindings/DefaultKeyBinding.dict
Please note that this software has only been tested on Mac OS X 10.4 and it does not fix the home and end keys in every program. While I believe that this software will not harm your system in any way, it is offered to you for FREE with NO GUARANTEE! Please post your feedback in the comments section.
Applications where this fix works (and doesn’t):
- TextEdit – works
- TextMate – works
- Pages – works
- Most text editors – works
- Safari – works (in form fields only)
- Firefox – doesn’t work (but fixed it with KeyFixer Firefox Edition)
- iTunes – doesn’t work







Doesn’t seem to work on Xcode either
You can set the keys on Xcode explicitly in the preferences.
In Safari it works on webpage input boxes, but doesn’t work in the address bar!
Any further solution for this?
The one place I wanted this to work, the terminal, it does not…..
Great little app, Jim!
In case you’re interested, I also came across this blog entry (http://weblog.0×7b.com/articles/2005/09/25/windows-keyboard-mapping-for-osx) which covers some of the same ground — and, in addition to the keybindings that KeyFixer takes care of, that entry also lists two more, for Ctrl+Home & Ctrl+End:
“^\UF729″ = “moveToBeginningOfDocument:”; /* control + home */
“^\UF72B” = “moveToEndOfDocument:”; /* control + end */
Ohh, I desperately need this to work in Firefox — especially on my MacBook where the Home and End keys are already a two-hand operation (one of my biggest pet peeves about the Mac portables, ugh).
I type a LOT in Firefox, and Eudora as well, where it apparently also doesn’t work. Will keep checking for updates!
For my purposes.
Thank you Very Much
Great, thanks a lot! All I need now is Firefox support to complete my switch :)
Thanks heaps! This utility is wonderful! The thing I have hated most since starting to use OS X is that the Home & End keys did not function properly, and now they do. It works in Mail.app too which is where I’ll use it most.
Thanks again
This post on o’reilly (http://www.oreillynet.com/linux/blog/2006/04/firefox_with_vim_keybindings.html) gives some clues to how to do it, although only on an application-wide scale. I’ve altered a file for Firefox (2.0.0.1) which fixes these, but there might be things which are just my personal preference.
Stuff I’ve removed or added is commented with ‘Removed’ or ‘Added’.
I’ve put up the jar replacement up at http://www.marcuscobden.co.uk/stuff/toolkit.jar.
Let me know if it’s any use you.
I tried the JAR, seems to be working just fine :)
Tried the JAR method above and it worked! You can do it one of two ways:
1. save the above toolkit.jar file over the existing one
2. merge the single changed document into your current .jar
If you want to do #2 (package JUST the changed platformHTMLBindings.xml file), see below.
For those of you not knowing the details of the command line options here are the highlights. Do NOT follow these commands blindly, know what they do, as many will need modifying if you have placed files or apps(firefox) into different directories than me. The “man ” command is your friend :-)
Download the toolkit.jar to your desktop
cd ~/Desktop/
jar xvf toolkit.jar
;this extracts the jar (which happens to be directories called “content” and “__MACOSX” with much inside of content. All you should need is the “content” dir) x=eXtract v=verbose
jar xvf /Applications/Firefox.app/Contents/MacOS/chrome/toolkit.jar
;extract the existing toolkit.jar file in the firefox app
rm -r __MACOSX/
;recursively removes the unneeded directory that came out when u unjar’ed the first file
mv ./content/global/platformHTMLBindings.xml /Applications/Firefox.app/Contents/MacOS/chrome/content/
;move the new file to the location with the your current .jar contents
cd /Applications/Firefox.app/Contents/MacOS/chrome/
jar cvf toolkit.jar content
;create a jar file with the old contents + the newly moved .xml file
AGAIN, know what these commands are doing. I didnt do a real test, so I may have slightly buggered up the commands. Gives you a good idea though.
Forgot a couple things in the walk through above.
1. This can be done the same way on thunderbird
2. backup your old toolkit.jar with something like ‘mv toolkit.jar toolkit.old.jar’
3. remove the temporary ‘content’ directories with ‘rm -r content/’
Wow, very nice! I have a Mac and PC on my desk and go back and forth between them, so anything that makes the key bindings more similar helps.
Re: joe above wanting it work in Terminal. I tried rebinding the keys in bash by modifying .inputrc without success (I think Terminal was eating them) but what does work nicely is to go to Terminal -> Window Settings -> Keyboard and tell “Home” to send string control-A, and “End” to send string control-E. Probably the same method could be used to pass the keys straight to bash for processing.
Very nice! Thanks! But it doesn’t seem to work with the eclipse IDE.
Here is the solution for eclipse:
http://www.kelek.com/blog/2006/09/16/fixing_home_end.html
Works like I expected home/end keys to work!
It was a real pain writing code without real home/end pgup/pgdwn!
Firefox seems to be a problem it still doesn’t understand those keys in inputs, textarea and url bar, but i can scroll through the page!?
thanks for the fix!
need a fix for opera though :/
You’re a life-saver! Thanks a ton man! :-)
It also doesn’t work in Flash in the actions pane.
A big thanksfor KeyFixer (for Firefox and other apps. And thanks to Rob for the instructions on getting Home and End to work properly in Terminal. That was one of the infuriating, perverse apsects about
Mac OS X.
Fantastic!!!
I’m a new Apple convert and this was the most glaring problem I was dealing w/ on a daily basis. Problem solved!
One question? How on EARTH do OSX users pull up the Menu bar using the keyboard? Yes, I know there are lots of shortcuts but in Windows I would frequently just type things I wanted to happen if a shortcut didn’t exist… I.e. In Excel I could hit “Alt” to drop down the Menu bar list. Alt+E (edit) then “S” then “V” (values), then hit Enter and never touch my mouse. Does Apple allow the “First letter of a Menu item” control??? Surely there is a way to @ least drop down the menubar so I can use my arrow keys to select items.?
One more question: Why doesn’t “Alt+Tab” work properly all the time? Sometimes I can Alt+Tab to other programs but sometimes it just brings up the “Header” of the program but not full body of the program so I can begin working in it (and I’m forced to grab my mouse and pull up the dock and click on the app again.)
Any/all Help would be GREATLY appreciated!
Thanks again for KeyFixer!!!
DoubleCommand takes care of this and much, much more. Plus is works in EVERY program.
“Today is the day” when I got tired of the page up/down behavior… after spending 3 years being frustrated I decided to see if there was a solution! You really saved my day and more days to come! Thank You so much for this nice script.
Thanks. I really mean it, I am just trying to get to grips with my new MAC and this was really start to annoy me. Running a PC news and reviews site I will probably get shot for writing here but I now can go back to pretending my MAC is a PC again. Thanks again for a great free app.
Thank you so much! I will never go back to Windows but there are a few things that drive me crazy about the Mac. Wanna know another? There’s no way (that I know of) to tile windows. I sure miss that sometimes when I’m working in two apps at once.
Any chance of having your “app” update the same values for Thunderbird? That is the killer for me. I write about 20 – 30 long emails a day and the end key behavior drives me nuts! Your app worked a treat on FF … just need to sort Thunderbird now.
Really cool stuff. Thanks for you effort.
Thanks! You ROCK! This program works perfectly. I will be sending a link to your site to all my Mac friends.
Hey, thanks!
This works on Bean as well.
I’ve been wanting something like this forever!
I can´t get it to work… I am using Leopard. Has anyone got it working in Leopard?
Update: Got it working now, great program! Unfortunately it doesn´t work in Thunderbird though. Any ideas of how do fix it in Thunderbird?
Thanks a lot! This is exactly what I am looking for!
Didn’t work in BBEdit, but then I noticed an option for it in Preferences ;)
Big thanks!
thanks very much – i missed this feature as a newbie to mac.
As a recent Mac convert, I couldn’t get used to the Mail default text editing keys. Starting with the explanation you posted, and then using information from the definitive discussion of key bindings at
http://www.hcs.harvard.edu/~jrus/Site/cocoa-text.html
and the sample file on
http://www.lsmason.com/articles/macosxkeybindings.html
I created the following slightly modified file. Note that the sample file didn’t work properly on my MacBook Pro with Leopard, but this file does, and adds one more relevant keystroke.
/* ~/Library/KeyBindings/DefaultKeyBinding.dict */
{
“^\U007F” = “deleteWordBackward:”;
“^\UF728″ = “deleteWordForward:”;
“\UF729″ = “moveToBeginningOfLine:”;
“^\UF729″ = “moveToBeginningOfDocument:”;
“$\UF729″ = “moveToBeginningOfLineAndModifySelection:”;
“$^\UF729″ = “moveToBeginningOfDocumentAndModifySelection:”;
“\UF72B” = “moveToEndOfLine:”;
“^\UF72B” = “moveToEndOfDocument:”;
“$\UF72B” = “moveToEndOfLineAndModifySelection:”;
“$^\UF72B” = “moveToEndOfDocumentAndModifySelection:”;
“^\UF703″ = “moveWordForward:”;
“$^\UF703″ = “moveWordForwardAndModifySelection:”;
“^\UF702″ = “moveWordBackward:”;
“$^\UF702″ = “moveWordBackwardAndModifySelection:”;
“\UF72C” = “pageUp:”;
“\UF72D” = “pageDown:”;
“^z” = “undo:”;
“$\UF728″ = “cut:”;
“$\UF746″ = “paste:”;
“^\UF746″ = “copy:”;
}
There are some oddities about the behaviour of Ctrl+shift+right arrow that I don’t quite understand (it is the only keystroke that doesn’t always seem to take the binding, apparently somehow related to the number of additional keystrokes mapped?!) and it’s not really possible to emulate Ctrl-up/down arrow properly (one can make it move to the beginning/end of the current paragraph but not to the beginning of the next para, which is kind of pointless) but this file makes text editing in Apple Mail much easier for a former PC user with established keyboard reflexes! Llew Mason’s sample file fixes Home/End plus Page Up/Down, provides Ctrl+right/left arrow to move by a word (and one can hold down shift to select) as well as Ctrl-Home/End to move to the beginning/end of the document; plus it adds classic PC editing features of Shift-Del to cut, Shift-Ins (the Help key on a Mac keyboard) to paste, Crtl-Ins to copy and Ctrl-Z to undo. I have got Ctrl-Backspace (Delete on a Mac) to work to delete a word backwards (on my machine it didn’t, using the sample file, nor did Ctrl-shift-right arrow behave) and have added Ctrl-Del (forward Delete on a Mac) to delete a word forwards.
Thank you thank you thank you!!! As a recent Windows to Mac convert, I have found every other aspect of the Mac platform superior with the exception of this one keyboard issue. Now my happiness is complete. You have made my day!!!!
KeyFixer works great on Pages in OS 10.5.2.
Thank you very much ! !
Thank you! Thank you! Thank you! I just switched from this other OS to the one and only and I loved everything but the keyboard layout. This is a great time saver!!!
Thank you very much, it’s working now great…. Really, it was such an annoying issue.
Thanks a ton. This has been a bug bear of mine since I moved to the mac OS in Jan 2008. Just brilliant.
Thanks, lovely.
This has totally bugged me since getting a full size keyboard for my Mac.
Another windows -> mac user now happier. But must say still lovin my mac.
With Firefox 2.0.0.14, this patch no longer seems to work. Has anyone else had this problem?
This is good info.. much appreciated. Another item I am trying to find is how to modify the word boundaries for text selection.. in iTerm, I can specify what characters make up words I want to click on to select. for example, if I have /dev/nst0 and click on that string “/dev/nst0″ in Terminal, it only selects “dev” or “nst0″, I need it to select “/dev/nst0″ so I can copy/paste. Any ideas on this for macs Terminal.app?
I loaded keyfixer and it creates the file in the proper directory. When I go into Apple Mail, home moves to the top of the email list but does not select the first email. Using Page up/down moves the content in the red pane below.
It seems like my system is not reading the .dict file.
Ok, it is reading the file now. Home and end now go to the start and end of a line in mail. However, when in the main email pane; home moves to the top of the email list but does not select the first email (same issue with end). Using Page up/down moves the content in the red pane below and does not page up or [age down through the email list.
This doesn’t work with Dreamweaver CS3.
i am a former PC user, and use a lot of MS Office, how do I say this … thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you (but unfortunately, it does not work in Firefox :( )
This freakin’ rocks! I love most of my Mac, but I spent enough time growing up in the PC world that some habits are hard to break (or not worth breaking). I set the scroll button on my Might Mouse to act as a right-click, and now (mucho thanks to you) I have my home and end keys back!
Another windows -> mac user now happier. And I’m still lovin my mac.
A useful little app. Thanks. I’ve never understood the odd default behavior of these keys. Thinks now work just about as expected. As a not for those who find it not working … quit and restart the app. That did the trick most of the time for me.
This is really good, i only just moved over from PC and my inability to use the home and end buttons was really annoying me so thanks for uploading this keyfixer. Thanks.
Fabulous!! Thank you!!
Thanks a million! Due to my current job, I work in Windows all day, so this helps bring things a little more in uniform.
brilliant! This still works with 10.5.5 and a brand new imac and extended KB, no idea how my mappings got scrambled but KeyFixer definitely fixed the problem. You rockl!
Thanks so much for making this, could not code productively on a Mac without it, was clawing my eyeballs out.
GREAT!!!!!!!!!!!!!!
Hi
I’ve installed yr app on my MacBook Air but I seem to be missing what to do next?
Apple+Arrow Up or Down takes me to beginning or end of line… which it did before I installed the app. What is the command to go to the top or bottom of the document, (CNTR+HOME or CNTR+END in windows?) It’s restarting my RSI doing all this endless scrolling in long Word documents. Would really appreciate some help, thanks. I love my new MAC but this is literally causing me pain!
awesome, this is one thing that was really pissing me off about osx.
Doesn’t work with ActionScript in Flash CS3 either.
yes, thank you. had to use this to fix my apple keyboard(!)
Another PC -> Mac convert now MUCH happier – I’m delighted to report Parallels supports this fix as well (DoubleCommand didn’t give me this keyboard functionality on my virtual Windows machine).
THANK YOU OMG
It also doesn’t work with the terminal application in applications/utilities
Thanks! … As for Eclipse 3.4 here is what I did for home and end keys. HTH
- Eclipse (has own bindings)
– Conflicts with Text End and Text Start but these are also bound to (cmd end and cmd home) so just unbind them.
Preferences > General.Keys > “Text Editing”
Command From To When
Line End (cmd right) (end) Editing Text
Line Start (cmd left) (home) Editing Text
Text End (end) Editing Text
Text Start (start) Editing Text
Select Line End (shift cmd right) (shift end) Editing Text
Select Line Start (shift cmd left) (shift home) Editing Text
Select Text End (shift end) (shift cmd end) Editing Text
Select Text Start (shift home) (shift cmd home) Editing Text
Good Lord, these issues with the keyboard are killing me. Thank God for your small program. I spend this morning researching how to make the Home/End work properly in Mac OS X, and then I was very frustrated to see that it worked everywhere except Firefox. Thank God, now everything is OK.
Great fix man, this has been driving me crazy in Pages….
Thanks so much! this was driving me nuts.
Thank you! You just made my day! :-D If the app would add functionality to make CTRL+Home/End move the cursor to the start/end of the file also, that would be even greater. :-)
Works for Coda v1.6.4 on OS X v10.5.6
Thank you so much
Work in Xcode! Thanks.
I just want to add that for me terminal is the main app that home and end not working sucks for me. Yes, I changed it manually, but it might be nice for others (or me, when I’m changing other systems), to have your thing change that, too. It seems to me it would at least be possible to have a separate install like you did for Firefox…
Works with DashCode 2.0.1 – THANK YOU!!!!
Man that feels good! I can now use XCode while enjoying the benefit of the “home” and “end” keys working in a useful manner…
Thanks so much for cracking this one – even worked while I was typing this response…
Its awesome application! Big thanx!
P.S. Tested in Coda.
You are awesome! Thank you for your time – you’ve saved a lot of my time. Just to let you know, this tool is working for me for Mail in Snow Leopard.
You Rock! Thank you so much!
I’m on Snow Leopard and it works in all the apps I’ve tried (including xcode).
Thanks for the download. I tried it on my new Macbook Pro (10.6.1) and it works like a charm. It’s great!!!
This is great. Thank you!!
Do you have a Key Fixer for the Opera browser?
Many thanks for this fix!! And to Rob for make it works in Terminal!
Many, many thanks! This has saved me immense frustration. It’s easy to learn new key combinations, but hard to unlearn old ones, and I was hitting “end” many times an hour and losing my place in the document.
Now that Firefox 3 is out, you may want to direct people to the add-on, since your version doesn’t work for 3.
https://addons.mozilla.org/en-US/firefox/addon/9796
FYI a good tip I found when migration from windows to mac where I once used the home key to go to start and end… if you hit command+A (select all) then hit either left or right arrow key to jump to that end of the line, didn’t even need a key for this in os x :)
For those of you wanting to fix your HOME and END buttons in the Terminal of OSX Snow Leopard so that they work similarly to a PC environment (e.g. through a remote ssh connection with a linux box, in midnight commander, vim, and so on) the correct ascii characters to enter into the Terminal/Preferences/Settings/Keyboard dialog are:
home: 33[1~
end: 33[4~
pgup: 33[5~
pgdown: 33[6~
correction to my previous comment:
the blog engine removed the two initial characters from my posted ascii codes.
so, again, these are the correct codes:
home: \33[1~
end: \33[4~
pgup: \33[5~
pgdown: \33[6~
okay, I’ll try again:
home: \033[1~
end: \033[4~
pgup: \033[5~
pgdown: \033[6~
(moderator, please edit my comments so the codes appear properly and I don’t appear an idiot:)
@szmash
Not exactly sure what you were trying to enter, but I couldn’t get any of those combinations to work. Doing like Rob said here, http://www.starryhope.com/tech/apple/2006/keyfixer/#comment-658 worked for me.
Thanks! Worked great!
Many many thankx! Works with xcode in my hackintosh like a charm :)
god bless you and your loved ones, from now until the end of all time.
i was losing hair over this.
FYI, this fixes home/end issues in coda as well.
Works for XCode, just what I was looking for – Thanks!