Installing MacVim via Homebrew

Installing MacVim via Homebrew

One of the easiest way to install MacVim is via Homebrew. If you do not have Homebrew installed I highly recommend you install it. Just go to this site brew.sh and follow the install instructions there.

Once you have home brew installed you should be able to run the command

$ brew install macvim

This will install and compile macvim if you have the appropriate dependencies installed. If your install completes then then you can stop right here and enjoy using macvim. However sometime you will be prompted with an error message asking you to install something or debug why it failed.

When I decided to install MacVim via Homebrew I was greeted with this lovely error message.

$ brew install macvim

==> Downloading https://github.com/b4winckler/macvim/archive/snapshot-73.tar.gz

Already downloaded: /Library/Caches/Homebrew/macvim-7.4-73.tar.gz

==> ./configure --with-features=huge --enable-multibyte --with-macarchs=x86_64 -

==> make

link.sh: Linked fine with a few libraries omitted

xcodebuild -project MacVim/MacVim.xcodeproj 

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

make[1]: *** [macvim] Error 1

make: *** [first] Error 2

READ THIS: https://github.com/Homebrew/homebrew/wiki/troubleshooting

These open issues may also help:

Macvim linked twice to Python and possible solution? (https://github.com/Homebrew/homebrew/issues/32119)

macvim failed to build on 10.9 because of x11 (https://github.com/Homebrew/homebrew/issues/30253)

The issue here was xcode's command line tools were not installed. If you do not have xcode already installed you will want to do so, its a very easy install via the mac app store.

Then you run this command.

$ xcode-select --install

Then you can feel free to try and brew install macvim. If it still fails you will want to run.

$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

Once that completes you should be able to run brew install macvim again. After that MacVim should compile on your machine and you’re ready to start vim-ing it up!