Apple - ZSH paste from the clipboard a command takes a few second to be write in the terminal

The final problem is related to zsh.

oh-my-zsh is executing bracketed-paste-magic, so I ended up removing it. Because oh-my-szh doesn't have a plugin manager for this. You have to override the file: $ZSH/lib/misc.zsh

The overrides will be in this folder $ZSH_CUSTOM.

Because I don't have any override I had to create the folder first: mkdir $ZSH_CUSTOM/lib/

And create a copy of the original cp $ZSH/lib/misc.zsh $ZSH_CUSTOM/lib/.

and edit the file (use your favorite editor):

vi $ZSH_CUSTOM/lib/misc.zsh

I commented the following lines, but you can remove it or change the if condition.

#if [[ $ZSH_VERSION != 5.1.1 ]]; then
#  for d in $fpath; do
#       if [[ -e "$d/url-quote-magic" ]]; then
#               if is-at-least 5.1; then
#                       autoload -Uz bracketed-paste-magic
#                       zle -N bracketed-paste bracketed-paste-magic
#               fi
#               autoload -Uz url-quote-magic
#               zle -N self-insert url-quote-magic
#      break
#       fi
#  done
#fi

Thanks and sorry for the question description, without the knowledge that I was using zsh this made the task to help me impossible to accomplish.

More info:

  • https://github.com/robbyrussell/oh-my-zsh/issues/5569
  • https://github.com/robbyrussell/oh-my-zsh/issues/6338

In your ~/.zshrc file (create it if it's not there) you can set DISABLE_MAGIC_FUNCTIONS=true and it will disable bracketed-paste-magic which is causing this issue.


It seems strange that you can download and use Hyper on macOS, because it seems to be windows only.

General Performance of iTerm

The FAQ from iTerms website suggests this:

Disable transparency and blur. Use a solid background color rather than an image.

You might also want to look into how many Triggers you have activated, as they are known to decrease performance. You can find these in Settings -> Profiles -> Advanced -> Triggers.

Pasting Performance in iTerm

I couldn't replicate your issue on my computer with this short text, but making it about 20 times longer the same happens here. My guess is that iTerm thinks that you are typing and redraws the whole text every time it sees a new character. The same happens on vim in macOS and Ubuntu (see here enter link description here)

Fixing Pasting Performance in iTerm

There does not seem to be an easy fix for these performance problems. If the FAQ did not help I suggest to use this command:

pbpaste >> test.sh && chmod +x test.sh && ./test.sh && rm test.sh

pbpaste accesses the clipboard (try pbpaste on its own) and >> test.sh writes it into the file test.sh. chmod+x test.sh will allow test.sh to be run from the terminal, ./test.sh runs it and rm test.sh will remove all files called test.sh. This works exactly the same as pasting it but without the performance decrease actually pasting it brings