Mac OS X Terminal: mouse support?

Is there a native option (ie. without installing extra soft/package/plugins) to enable mouse support in the Terminal app?

Actually, I'm using a lot vim with the option set mouse=a (activating mouse features).

But it seems that Terminal doesn't support all xterm's features.

It appears (after some googling) that Terminal had once the mouse support, but I wonder where did it go.

N.B: I really want mouse support in Terminal, not only for vim, so please, don't suggest MacVim :]


I found the answer!

A friend told me the trick, it's so easy that I'm ashamed.

Just press alt key and click! (with mouse support previously activated in vim)


UPDATE for OSX 10.11 El Capita

Please see Chris Page answer.


As of OS X 10.11 El Capitan, Terminal supports Mouse Reporting.

Note that programs that support Mouse Reporting must enable it via escape sequences, and that most programs that support Mouse Reporting must be configured to enable it. For example, in Vim you must execute set mouse=a (usually in your ~/.vimrc file).

Terminal supports reporting three mouse buttons and a scroll wheel. To simulate a button-three press with a two-button device, you can use Command-Right-Click. (Command-Right-Click also performs Edit > Paste Selection when Mouse Reporting is off, so Middle-Click will paste the most-recently selected text whether you're using Mouse Reporting or not.)

When Mouse Reporting is enabled, the Option ⌥ modifier key is mapped to Meta for clicking and scrolling, and is unaffected by the “Use Option as Meta key” Keyboard preference, which only applies to keyboard input.

To temporarily bypass Mouse Reporting and interact with the terminal view, press the Fn modifier key while clicking or scrolling. There is also a View > Allow Mouse Reporting (⌘R) menu item you can use to bypass Mouse Reporting for longer periods of time, or if the modifier key isn't available.

Note that, when enabled, Mouse Reporting supersedes Terminal's existing Option-Click behavior (which sends arrow-key input to move the cursor) and “Scroll alternate screen” behavior. Also, the new Allow Mouse Reporting menu item and the Fn modifier also apply to “Scroll alternate screen” to let you temporarily bypass this behavior.


As an alternative to using Alt-click to set the cursor in vi with OS X Terminal, I would like to suggest using iTerm 2:

  • http://www.iterm2.com/#/section/home

I wanted mouse support in Terminal vi (Mac OS X 10.7 Lion), but there's no support for scrolling with the scroll wheel. I ended up switching from Terminal to iTerm 2, which supports vi scroll wheel scrolling, and you don't need to hold down alt to set the cursor.

If you don't use some of the more advanced features in Lion's Terminal app, you may be quite happy with iTerm 2.

Edit: To enable mouse support in Vim when using iTerm 2, add the following line to your .vimrc:

:set mouse=a

It appears that on OS X 10.4 (I'm not sure about 10.5) you can enable mouse support. Open the Terminal, then click on Window Settings. Click Emulation from the drop down list and then check the option "Click to position Cursor".


Note that Mac OS X does have xterm in addition to Terminal.app. I couldn't tell from your question if you were aware of this. But if you have the X11 package installed you can fire up an xterm window and mouse support works just fine.