I'm using (roughly) the same config for my mac and my ubuntu machine. I use

set clipboard=unnamed,unnamedplus

To conveniently share vim's clipboard with the system clipboard. However, lately the clipboard sharing broke under Mac OS X.

I have no idea what I did to break it, it still works fine under ubuntu. I've tried completely removing and reinstalling vim (via homebrew), deleting my .vimrc and .zshrc files, and still it doesn't seem to work.

Now, when I have

set clipboard=unnamed,unnamedplus

I cannot paste at all with vim. When I set

set clipboard=

then I can at least paste in vim, but of course it doesn't share the system clipboard (duh). Using :reg confirms that with anything other than set clipboard=, nothing is written to vim's registers. :version gives me +clipboard and +xterm_clipboard. I've also tried it in iTerm2 and Terminal.app, both in and outside of tmux (same results). Also, manually copying to the registers ("*yy, "+yy) didn't work.

Interestingly, the the GUI-version (MacVim 7.4-74, also installed via homebrew) still functions fine in this regard, I can happily copy/paste to/from the system register there.

Do you guys have any ideas? Cause I'm desperate at this point...

Here's my .vimrc: https://github.com/DeX3/dotfiles/blob/master/.vimrc

  • Do you use tmux? – romainl Apr 27 '15 at 7:38
  • @romainl yes, the error occurs both inside and outside of tmux though – DeX3 Apr 27 '15 at 7:52
  • 2
    I would recommend using MacVim instead, as it plays better in Mac OS. You don't have to use the GUI version -- mvim -v will work in the terminal. – tommcdo Apr 27 '15 at 11:30
  • @tommcdo in mvim -v it works! Both in and outside of tmux! Boy am I glad... I'm just gonna alias that now. No idea what broke it in the first place, but I'm just glad this works. Thanks! If you make your comment an answer, I'll accept it. – DeX3 Apr 30 '15 at 10:36
  • I have the same issue, also in macvim. – dimid Jun 6 '17 at 17:46


Under OS X, it's best to use MacVim. OS X behaves differently to other operating systems when it comes to things like clipboard management. MacVim is specifically designed to address the areas where Vim falls short on the Mac.

Coming to a terminal near you

Although MacVim runs as a GUI (like GVim) by default, you can use MacVim in the terminal using mvim -v. I'd recommend an alias such as the following (I'm using bash syntax; adjust according to your shell):

alias vim='mvim -v'
  • Alternatively, use Homebrew and run brew install vim --override-system-vi. – squarefrog Apr 30 '15 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.