Getting MacVim to run properly on Yosemite

I had postponed upgrading to Yosemite because of all the horror stories about 24-hour delays while the installation program copied all homebrew files from /usr/local to hell and back, and things running slowly afterwards, and, well, what always happens when you upgrade.

But I am progressive by nature and there were several things I wanted to install that required Yosemite and that was going to be a thing too. My great surprise was first that perhaps because I have a solid state drive on my MacBook Air, there was a delay, but not that much. And secondly, everything was snappy as all getout after the upgrade. I felt like I had a new computer running!

MacVim has long been my standard Mac text editor, and gvim on Linux, although now Atom with the vim mode and markdown plugins is vying for that position (make sure it's always running to avoid delays in loading), along with LightPaper for Mac for markdown. Imagine my chagrin when I attempted to open a text file on Yosemite with MacVim, only to find that while the application launched, the window didn't. No go.

This article explains what I did to remedy the situation completely on my MacBook and bring MacVim back to the contender status it deserves.

The secret is to reinstall MacVim again using homebrew. See:

However, homebrew didn't want to install MacVim. First I decided to update homebrew itself, and was greeted by the following error (something individual to my machine I think):

$ brew update

error: Your local changes to the following files would be overwritten by merge:

README.md

Please, commit your changes or stash them before you can merge.

Aborting

Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master

After some research I did:

$ git reset --hard FETCH_HEAD

HEAD is now at 834f2b1 wine: don't require universal deps on 32-bit Intel

Victors-MacBook-Air:local victorkane$ brew update

Already up-to-date.

OK! Now can I haz macvim?

$ brew install macvim

==> Downloading https://github.com/macvim-dev/macvim/archive/snapshot-74.tar.gz

######################################################################## 100.0%

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

checking for suffix of executables...

checking whether we are cross compiling... configure: error: in `/private/tmp/macvim20150405-15713-1b2csf4/macvim-snapshot-74/src':

configure: error: cannot run C compiled programs.

If you meant to cross compile, use `--host'.

See `config.log' for more details

because XCode needed to be updated from the App Store otherwise nothing could be compliled or built.

Warning: Your Xcode (5.1.1) is outdated

Please update to Xcode 6.1.

Xcode can be updated from the App Store

So I did that, and fortunately it didn't take that long. Then

$ brew update
Already up-to-date.
Victors-MacBook-Air:local victorkane$ brew install macvim
Warning: You have not agreed to the Xcode license.
Builds will fail! Agree to the license by opening Xcode.app or running:
sudo xcodebuild -license

After agreeing to the license I was able to do:

$ brew install macvim
==> Downloading https://github.com/macvim-dev/macvim/archive/snapshot-74.tar.gz
Already downloaded: /Library/Caches/Homebrew/macvim-7.4-74.tar.gz
==> ./configure --with-features=huge --enable-multibyte --with-macarchs=x86_64 -
==> make
==> Caveats
.app bundles were installed.
Run `brew linkapps macvim` to symlink these to /Applications.
==> Summary

Now, one might think that MacVim was already set to go, and might easily overlook the last two lines. I did, I right-clicked on a text file and no MacVim suggested as associated application. I go to Aplications, not a sign of MacVim. Then I go back and I see that the linking of macvim to /Applications has to be done by hand, so I do:

$ brew linkapps macvim

Victory in our time, at last! I right click on a text fiile, and there is the green V in the Open With list. And it works like a charm, the window opens, I have my MacVim back. I go to the Applications folder, and there it is.