I work on a terminal most of the time.

Is there an application / plugin over iTerm or any other terminal like application using which I can control the cursor location of my terminal using a mouse ?

  • What do you want to do at the cursor?
    – mmmmmm
    Commented Feb 23, 2011 at 15:49
  • 1
    I would like to jump to the cursor. Use case being, If I have a long line delimited by space, I would like to jump to a particular location. using the keyboard takes many keystrokes.
    – Sairam
    Commented Feb 23, 2011 at 16:11
  • If you are already using Terminal you probably appreciate the keyboard. Learn the keyboard shortcuts to jump to front/back of line, and navigate by word, and it will save you many keystrokes and probably be faster than the mouse.
    – user588
    Commented Feb 23, 2011 at 16:23
  • 1
    See also apple.stackexchange.com/a/217167/24565 for info on mouse options for tmux Commented Nov 26, 2015 at 10:00

6 Answers 6


At least in Terminal.app you can hold down option while clicking to jump within your current line (that actually means just the line, so if your current prompt is so long that it wraps to a second line of input you'll have to option-click to the beginning of the "second" line and then hop with the arrow keys to the "first" line where you can option-click again.)

  • 1
    Option click, interesting. Never knew that one before. Be sure to click on the line though, holy crap. I don't even understand what's happening when I click above/below the current line. I assume it's pressing up a number of times, but I'm pretty sure the command history isn't exactly matching up. Commented Feb 23, 2011 at 18:49
  • Well, it´s only reading the number of columns where ever you click and jumps to that position in the current (!) line; so if you are at the end of a wrapped prompt (say line 2: column 45) and you option-click on something in the first line (say line 1: column 4) you will end up in column 4 (great) but will stay in line 2 (wrong!).
    – Asmus
    Commented Feb 24, 2011 at 6:39
  • 2
    The way Option-Click works is that it issues the equivalent of arrow key inputs. This works well in editors like emacs, but if you're at the bash command prompt, it interprets up/down as "previous/next command in history". So, if you Option-Click anywhere except the same row that contains the prompt, bash goes through your command history instead of moving the cursor.
    – Chris Page
    Commented Aug 14, 2011 at 2:06
  • Works in iTerm2. Commented Jul 19, 2017 at 17:55
  • Is there anyway to option click a different line in iterm like terminal?
    – aeroxy
    Commented Feb 8, 2020 at 14:08

It's quite a time since this question came up and I did already mention the below on this platform in Option-click in iTerm and the issue tracker of iTerm2 but maybe it's of help for one or the other:

Hi, just wanted to let you know that I implemented that feature in iTerm2. It's not yet in the official iTerm2 repo but if you'd like to give it a go, you can find it at github.

Since it's tested only by me consider it not-stable. I did test it with bash, vi and emacs and did my best to resemble Terminal.app behavior.

There's a precompiled binary on github too iTerm_v1.0.0.20120312.git-b919985b.zip (for i386/x86_64/ppc).

Of course any feedback is welcome.

  • Did mouse reporting break in the last release? It no longer works for me, I don't see the cursor "o" and I can't figure out how to get it back.
    – Michael
    Commented Jul 16, 2014 at 15:28
  • I take that back. Mouse reporting doesn't work only in some cases - for instance, if you ssh to another machine, then attach to a tmux session already running emacs. This used to work. Now you sometimes have to exit out of emacs and restart it before mouse reporting works...
    – Michael
    Commented Jul 16, 2014 at 17:44
  • It only seems to go to a position anywhere on the current line. Is it possible to option-click anywhere on the active command?
    – Oion Akif
    Commented Apr 17, 2017 at 22:25

In iTerm2 you hold down alt (left or right) and click to move the cursor to any position on any line.

  • This is useful info, but the question was targeted at using a mouse.
    – ray
    Commented May 23 at 2:02

The keyboard is often your best friend. In a default configuration, your shell controls much of how you navigate around the command prompt.

Option + b goes back a word (the cursor will end up at the first letter of the previous word).

Option + f goes forward a word (the cursor will be at the non-letter character AFTER the next word).

Shift + Fn + Left Arrow (←) will put the cursor at the very start of the line. (Ctrl + a will also do this.)

Shift + Fn + Right Arrow (→) will put the cursor at the very end of the line. (Ctrl + e will also do this.)

So if I have a long command, for example:

$ rsync -avz --progress ~/Sites/Development/My/Project web@server:/deployment/output/area

And I start hitting Option + b, the cursor will stop on the a in area, the o in output, the d in deployment, etc.

If I go to the start of the line, and start hitting Option + f, the cursor will stop at the space after rsync, the space after avz, the space after progress, the / after Sites, etc.

  • I like your "XY problem" mindful solution. While not answering the original question it is a very worthy alternative. Is it on purpose though that you sometimes say CMD+b and option+b? Commented Oct 18, 2019 at 17:48
  • 1
    No, that was a mistake on my part. Command never should have been used here because that controls Terminal window behaviors, not shell / movement behaviors. Commented Oct 18, 2019 at 19:21

If you are specifically interested in movement in Vim, then you can add set mouse=a to your ~/.vimrc file.

It does work in iTerm for movement. It also allows you to mark sections as if you had entered visual mode, so that you can yank or delete it or comment out code depending on your plugins.

Very conveniently it also lets you quickly scroll through a large document using a two-finger slide or mouse wheel.

The only drawback is that it makes it difficult to select text that you want to copy for use in other applications—though all you have to do is press option while you select.

Also: note that, if you add something like vimpager (also on macports), then you can also scroll through man pages once you add:

export PAGER=/opt/local/bin/vimpager #or wherever vimpager is installed
alias less=$PAGER

to your .profile or .bashrc.


When option click doesn't work, it seems that it's possible to do this with the fn key. Over an ssh session in iTerm2, I was able to hold fn and click where I wanted the cursor to move in vim normal mode, for example.


You must log in to answer this question.

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