Suspended (tty output) when launching editors like vim, vi, emacs, or nano

I've been using Oh-My-ZSH for a few weeks now and it's been a great experience. Just today, though, terminal started acting strangely. When I try to run an interactive terminal editor like vim, vi, emacs, or nano, the process is suspended:

$ vim
[1] + 3515 suspended (tty output) vim

Of course, I can open it back up with fg, but this is incredibly annoying.

I wasn't experiencing this issue yesterday. Since then I haven't restarted my computer, iTerm, or even closed terminal tabs (from which I successfully ran vim yesterday without it being suspended).

Additionally, I temporarily reverted my shell back to bash. It now exhibits this same suspending behavior as ZSH. This problem occurs both in iTerm2 and the native osx Terminal.app for both bash and zsh, so presumably this isn't an issue with my shell.

I've been through every solution on the first 10 pages of Google for this issue, but haven't found one that resolves it. I'm approaching the point where I no longer understand why this is happening and therefore can't debug it.

Is there any way that I can get interactive processes like vim to stop suspending themselves when I try to run them from terminal?

Edit: Since this post I've tried new iTerm & Terminal tabs, relaunched iTerm & Terminal, and restarted my computer. All of these have failed to resolve this issue.


Terminal is suspending the editor because some other process is writing to the terminal.

Running stty -tostop should fix it.

If that does not fix the problem, take a look at this GitHub issue from the oh-my-zsh repository.

the issue results from a setting :set shellcmdflag=-ic. After I comment[ed] that out from .vimrc all relevant problems were solved.

Other users have evidently run into this problem. This seems to be the correct solution.


Turns out I misread the first result on Google. I incorrectly assumed that they were referring to the terminal shell (and when they said shell later on I assumed they meant $SHELL, although I should've been tipped off by the fact that shell wasn't capitalized). Instead they were referring to the vim shell setting, which incorrectly had the -i flag instead of the -l flag.

So in case anyone else has this issue, go into your .vimrc and change make sure the line that sets your shell looks like this:

set shell=/bin/zsh\ -l

(Replacing /bin/zsh with the value of which zsh if it's installed in a non-standard location, of course).

Reference commit: https://github.com/devx/vimified/commit/772e130c9c359ac87927a963e00a9cc6597cd170