I'm ssh-ed into a remote machine and running tail -f. Every time I scroll up/down using the trackpad, it yields some strange characters, like


This didn't used to happen before, and it won't let me scroll up to see previous logs. Why is it happening, and how can I disable it?

  • Looks like the scrolling operation is being translated into the escape sequences that arrow keys send.
    – Barmar
    Commented Jan 23, 2015 at 20:46

2 Answers 2


TL;DR: Check the menu setting View->Show/Hide alternate screen. You may be in "alternate screen mode". Or try using the SHIFT key when you scroll to get the other scrolling behavior.

^[ is the printable representation of Control-leftbracket, AKA the escape character. Infocmp reveals that ^[OB is the xterm escape sequence for the down-arrow key (^[OA is the up arrow sequence). Terminal emulates xterm and it's translating your mouse scrolling into arrow-key sequences.

I found some past discussions of using the mouse in Terminal:

But they're all about previous versions of OSX, and it seems that Terminal has changed in this area over time. This article talks about how it works in Yosemite, but it's a little short on technical detail. The rest of this is what I've found by playing with Terminal in Yosemite.

The terminal has two modes for handling mouse scroll:

  1. In one mode, scrolling causes the terminal to scroll the viewport, so you can see the terminal's scrollback buffer (the lines that have scrolled off the top of the screen). You get an OSX scrollbar when you scroll the terminal.
  2. In the other mode, scrolling causes the terminal to send arrow-up and arrow-down sequences. The program running in the terminal will hopefully be able to handle them.

You can temporarily toggle between modes by holding down SHIFT while scrolling. E.g. while the terminal is displaying a command prompt, scroll will scroll the terminal window, while Shift-scroll will roll through your bash command history.

Terminal also provides a feature called an alternate screen. Full-screen programs like vim or less can switch the terminal to an alternate screen to display their own content. When you exit such a program, the terminal switches back to the main screen. I mention this because Terminal's scrolling behavior can change on the alternate screen.

Normally, the 1st scroll behavior is the main behavior, and you have to press SHIFT to get the 2nd behavior. But go to Terminal->Preferences->Profiles->Keyboard. At the bottom is a checkbox labelled "Scroll alternate screen". If that box is checked, then scrolling behavior reverses on the alternate screen. When checked, the 2nd scrolling behavior becomes the default for the alternate screen, and you have to press SHIFT to get the 1st behavior.

So for example, from the command line, scrolling the mouse lets you see the terminal's scrollback buffer. But start vim to edit a file, it switches to the alternate screen, and suddenly scrolling the mouse moves the cursor. Which is what you want inside vim.

Getting to your problem, it sounds like your terminal is displaying the alternate screen. There's a menu option to switch (View->Show/Hide Alternate Screen). Or something you're running is putting the terminal into alternate screen mode. Maybe you're using screen or tmux or something like that? As a workaround, you could try using the SHIFT key to get the scrolling behavior you want. Or you could uncheck that checkbox.


I changed my terminal emulation to vt100 from xterm-256color. I did this in Preferences => Profile => Advanced "Declare Terminal as:" dropdown.

You must log in to answer this question.

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