I'm a Mac Noob but generally a power Linux user. My new job handed me a fresh MacBook Pro with Lion installed.

I installed MacVim successfully using homebrew. I'd love for it to be the default app for opening certain file types. (.rb, .haml)

But when I attempt to assign MacVim as the default app in the Finder, the app is unheard of. A Spotlight search on MacVim turns up only the original .tgz file.

Yet I can run it from a command line (mvim) and pin it to the dock and run it from there.

I'm guessing something called an "alias" needs to be created, and I get the impression this is something different from a symbolic link. Indeed I have a symbolic link in my ~/Applications folder for MacVim, created there by homebrew.

How can I somehow bless MacVim to be an installed app and assign it to open certain file extensions?

This question came from our site for professional and enthusiast programmers.

1

Try brew link macvim. Ah wait... I also had a problem that somehow my link didn't work although it was there. You can unlink it first and link again and if that does not work, reinstall it.
–
FelixOct 13 '11 at 20:59

well that didn't seem to have any effect ...
–
MojoOct 14 '11 at 15:06

Do the instructions for MacVim as a "regular" app work? That would eliminate any question that it could be the binary itself.
–
digitxpOct 15 '11 at 13:36

One of the things you will see is that attribute called "com.apple.quarantine" is set for the MacVim.app folder (and for all files within its tree). If you start the app you will get a warning from OS X like "this app has been downloaded from the internet - do you want to proceed" and when you say yes it will un-quarantine the files in the app. You can do this manually for all files in the MacVim.app folder tree by using the Terminal command:

xattr -dr com.apple.quarantine MacVim.app

Or for just one file with the command:

xattr -d com.apple.quarantine somefile

I downloaded MacVim 7.3 and this would not work until I did the xattr -dr ... command, but as soon as I did, it started working fine from wherever it was installed. Set a file to use MacVim to open it and it also worked (using the "GetInfo" dialog box).

The location of the MacVim app is not really important. It's just that by convention, apps are usually located in the /Applications folder. This might not be true for some apps, but just for the sake of uniformity it probably is a good idea.

Sometimes there might be a reason why this isn't practical, like maybe you don't have write permission to the /Applications folder.

What worked for me is to copy the whole MacVim.app tree from where homebrew installed it (/usr/local/Cellar/...) to /Applications. A sym link was insufficient, and I couldn't make an "alias" that worked.