Make Home / End key move the cursor to the beginning / end of line on Mac OS X

Add the following lines in your ~/Library/KeyBindings/DefaultKeyBinding.dict:

{
  "\UF729"  = "moveToBeginningOfLine:";
  "\UF72B"  = "moveToEndOfLine:";
  "$\UF729" = "moveToBeginningOfLineAndModifySelection:";
  "$\UF72B" = "moveToEndOfLineAndModifySelection:";
}

Reference: http://www.evansweb.info/2005/03/24/mac-os-x-and-home-end-keys/

Make Home / End key move the cursor to the beginning / end of line on Mac OS X