I have an interesting problem: when I type something in the terminal as follows:

~ me$ hello<cursor>

and backtrack:

~ me$ he<cursor>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<cursor stuck here>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.


2 Answers 2


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


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.


Since I don't have enough reps to add this as a comment, I'll have to ask this in the answer section (even though it's discouraged).

First, how are you trying to move the cursor? Are you using the arrow keys or are you using the basic vi commands? i.e. have you tried: $ ?

Anyway, it would be helpful if you gave more detail as to the specific keys you're pressing in the example you provided (i.e. whether arrows or shortcuts and, if the latter, which specific key combinations).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .