OS X terminal Keyboard bindings for Home and End are messed up by default. Below is a guide to fix it.
Go to Terminal > Preferences, or better yet, Command + ,.
On the Settings tab, choose the profile you use, and go to the Keyboard tab.
Look for the home and end entry, edit each of them with the following settings:
Key: home
Modifier: none
Action: send string to shell:
Text: \033OH (Press escape to show ‘\033′, then enter ‘O’ as in Orange, not Zero, and ‘H’)
Key: end
Modifier: none
Action: send string to shell:
Text: \033OF (Press escape to show ‘\033′, then enter ‘O’ as in Orange, not Zero, and ‘F’)