Weird OS X Terminal Bug: Cursor won't go back to end of line after backtracking I have an interesting problem: when I type something in the terminal as follows: 

~ me$ hello&lt;cursor&gt;


and backtrack:

~ me$ he&lt;cursor&gt;llo


and then try to return to the end to continue typing, perhaps after fixing an error, I get stuck before the last character:

~ me$ hell&lt;cursor stuck here&gt;o


Anyone know how to fix this? I've tried looking around and changing the terminal to xterm instead of xterm-256-color, etc. but no luck. Any help is greatly appreciated!

Edit: I am using the arrow keys to move back and forth.
I know this is an old question, but I've been beating my head over this for a few days now and I've finally got it. It turns out the solution is simple: update bash to 4.3. The default bash on Macs (even Yosemite) is 3.2.

Install Homebrew with

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


then do

brew install bash


then change your default shell path (in Terminal Preferences) to

/usr/local/bin/bash


and that's it. Check your bash version with

bash --version


and as an added bonus, you can get mode indicators!

bind 'set show-mode-in-prompt on'


and it will show a + for Insert mode and : for Command mode.