The problem I have happens after a ssh connection has been ended by closing my MacBook (putting it in stand-by mode). I come back and it's written broken pipe.

When I click on the terminal window, a succession of characters appear. If I click several times, then the combination of these characters will appear the same number of times.

By moving my cursor, I can change the combination of letters...
Here, between every line, I moved my cursor somewhere else on my Desktop.

The strange behaviour in image

The content of my ~/.bash_profile is:

# Tell ls to be colourful
export CLICOLOR=1
export LSCOLORS=Exfxcxdxbxegedabagacad

# Tell grep to highlight matches
export GREP_OPTIONS='--color=auto'

export TERM="xterm-color"
PS1='\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\]:\[\e[0;34m\]\w\[\e[0m\]\$ '

# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
export PATH

# added by Anaconda3 5.2.0 installer
export PATH="/anaconda3/bin:$PATH"


  • macOS High Sierra version 10.13.5
  • What is in your ~/.bash_profile ? – user151019 Jul 10 '18 at 10:12
  • Amazing. I'm sure several of us will learn something here. I can't imagine what went wrong, but it would be good to reset the terminal (once) and then log out of the user account (once) and log back in to be sure this is an ongoing issue. If after the above and you reboot and the click data still happens - this might get interesting. – bmike Jul 10 '18 at 11:33
  • @Mark I added the content of my ~/.bash_profile – vinzee Jul 10 '18 at 11:54
  • @bmike I opened a new terminal window (without closing the former one) and the problem is not present on the new one, but still present on the former. I'll try to reproduce the issue on the new one to understand why it's happening. – vinzee Jul 10 '18 at 12:02
  • 1
    And a friend of mine just tested it and he discovered that the position of the pointer on the terminal will change the succession of letters, even without clicking anywhere – vinzee Jul 10 '18 at 12:06

You have somehow activated the terminal's mouse tracking mode. This is usually used by terminal applications which accept mouse input (like vim), which can interpret these character sequences as mouse events. The shell does not support mouse input, so it displays these sequences directly.

You can turn off mouse tracking mode by running the reset command in the terminal.

  • 1
    It does not work.. I typed reset on one of the buggy terminals, and when I click, the successions of letters still appear. – vinzee Jul 10 '18 at 15:45
  • It worked for me. – Paul Slocum Jan 8 at 22:20
  • worked for me in iTerm2 3.1.5 on MacOS 10.14.4 – rexford May 10 at 11:59
  • While it works for me, it's only a temporary solution, as something seems to "enable" mouse tracking for me during my normal usage of the terminal. Typing reset every time is only a stop gap solution. – Ehsan Kia Dec 2 at 16:51

When the Terminal (well, one of its ttys, anyway) is not accepting keyboard input in a reliable manner and needs a hard reset, either:

A.) hold down the ⌥ and ⌘ keys, and tap the R key [option-command-r]; or:
B.) Invoke the same action under the "Shell" dropdown menu of Terminal.app:

Terminal Hard Reset

You must log in to answer this question.

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