Upgrading vim on Mac OSX Yosemite via brew

I use vim. I upgraded to OSX Yosemite. I used to have MacVim, but then that suddenly stopped working. I had originally aliased my vim to the one within the MacVim installation like so:

alias vim=’/Applications/MacVim.app/Contents/MacOS/Vim’

That way I got the latest vim version (7.4.x) to work with on the command line. But when MacVim stopped working, I had to go back to vim 7.3.x which was previously installed. That had been, unfortunately, compiled without the options to copy between vim and the system clipboard. (i.e. by copying into the + register with command mode “+y). There began my search for finding out a way to upgrade the command line vim version. I already had brew installed. So I did a:

brew install vim

But I got an error that the file http://ftp.debian.org/debian/pool/main/v/vim/vim_7.4.273.orig.tar.gz was not found. I followed that path upto debian/pool/main/v/vim and discovered that the file had been updated. It was version 7.4.488 now. I ran a brew update but that got me nowhere. I wondered if I could manually edit the brew Formula to look for a different file. First I downloaded the latest vim_7.4.488.orig.tar.gz from the debian ftp and got its sha code. Then I edited the vim brew formula.

cd /usr/local/Library/Formula
vim vim.rb

In the vim.rb file, lines 7 and 8 became:

url ‘http://ftp.debian.org/debian/pool/main/v/vim/vim_7.4.488.orig.tar.gz'
sha1 ‘6edad8cf9a08acb6a6e415b89bb13ccbd887d7c3'

Then on running brew install vim, it downloaded the latest file, installed it, and got me a cool vim version 7.4.x to work on.

p.s. If your MacVim stopped working, you can try to remove your current MacVim.app in your Applications folder and then install in again via brew:

brew install macvim

Then you’ll have to add a link to the Applications folder by following the instructions in case the previous brew install worked fine:

brew linkapps

Now your MacVim.app should be sitting in your Applications folder and ready to use.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.