129

I am using OS X 10.9.1 (Mavericks).

What are the systematic steps to install to Gvim or MacVim in Mac OS? If you write the steps using 1, 2, 3, ..., it would be easy to follow.

I must confess that I failed to understand all the instructions provided on MacVim page. Other google-searched webpages do not clarify. E.g.

What is $VIMRUNTIME ? What version of vim should I install for my OS?

Now somehow I have installed MacVim in my system (Not systematically I believe). I can see that I have a folder /Applications/gvim.app/MacVim.app/.

Now when I open a text file from MacVim, which was already written using vi-editor, MacVim does not recognize it. Also vi does not recognize whatever is written in MacVim!

How can I resolve this?

Undo
  • 25,204
  • 37
  • 102
  • 124
hbaromega
  • 2,139
  • 2
  • 16
  • 26

4 Answers4

265
  • Step 1. Install homebrew from here: http://brew.sh
  • Step 1.1. Run export PATH=/usr/local/bin:$PATH
  • Step 2. Run brew update
  • Step 3. Run brew install vim && brew install macvim
  • Step 4. Run brew link macvim

You now have the latest versions of vim and macvim managed by brew. Run brew update && brew upgrade every once in a while to upgrade them.

This includes the installation of the CLI mvim and the mac application (which both point to the same thing).

I use this setup and it works like a charm. Brew even takes care of installing vim with the preferable options.

reem
  • 6,748
  • 4
  • 15
  • 26
  • 1
    Upping this. The `brew`-ed MacVim is updated much more frequently than the one from the link Peter posted. Both work though. – krystah Jan 09 '14 at 07:24
  • 1
    Nice, does brew install binary packages or compile from source? – Peter Gibson Jan 09 '14 at 22:55
  • 2
    Compiles it from source. You can take a look at https://github.com/Homebrew/homebrew/blob/master/Library/Formula/macvim.rb to see the actual ruby script that brew uses to install it. – reem Jan 10 '14 at 21:29
  • 1
    You can also run `brew edit formula` to see/edit the source of the script that installs that formula in your editor. – reem Jan 10 '14 at 21:31
  • 11
    Not sure when this was added but linking the app now requires running `brew linkapps`. – Kara Brightwell Aug 20 '14 at 13:23
  • Hi there, I followed your list of steps and installed homebrew, but when I got to step 3, it failed to download cscope and then the installation failed. Do you know what to do now? – Sam Feb 17 '15 at 17:49
  • Some plugins don't play nice with brewed vim, alas: https://github.com/Valloric/YouCompleteMe recommends building macvim from scratch. – Ahmed Fasih May 28 '15 at 11:12
  • Expanding on [reem](http://stackoverflow.com/a/21012284/1043380)'s answer: if you have trouble with brew you can run the command `brew doctor` and see if your brew has anything it needs to run correctly. – rbbt Apr 09 '15 at 18:56
  • I didn't already have the full Xcode installed, so it went part way and balked at that. Installed Xcode via App Store and reran, and it got into a no-win situation where running brew without sudo got "Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo." and running it with sudo got "You can use brew with sudo, but only if the brew executable is owned by root. However, this is both not recommended and completely unsupported so do so at your own risk." Fixed by running `sudo xcodebuild -license` – Eric Angell Sep 24 '15 at 00:59
  • 9
    Also, to make this work with Spotlight, I found that right clicking the homebrew MacVim application (/usr/local/Cellar/macvim/7.4-81/MacVim) > "Make Alias" and moving that into /Applications Spotlight will then pick it up. Don't know why the brew linakapps alias doesn't get picked up by Spotlight. (this is as of brew 0.9.5 on OS X El Capitan) – DonnaLea Nov 10 '15 at 19:13
  • 1
    I also ran into the Xcode issue and ended up getting it to work by doing `brew cask install macvim --override-system-vim` – aug Apr 04 '16 at 23:40
31

There is also a new option now in http://vimr.org/, which looks quite promising.

Xuan
  • 4,632
  • 1
  • 29
  • 30
16
  1. Download the latest build from https://github.com/macvim-dev/macvim/releases

  2. Expand the archive.

  3. Put MacVim.app into /Applications/.

Done.

golddove
  • 1,123
  • 2
  • 14
  • 30
romainl
  • 158,436
  • 18
  • 236
  • 264
  • "Expand it"? I'm looking, but the only way I see to get the app built as a .app from that link is to compile it (requiring the 4+ GB download of Xcode). Is this answer still valid? – Wildcard Sep 24 '16 at 09:46
  • 4
    Of course it's still valid. GitHub is not exactly a model in terms of UX so I forgive you for missing the "Releases" link. – romainl Sep 24 '16 at 10:12
  • 1
    Ha, thanks. Of course I see this after I finish downloading and compiling manually.... – Wildcard Sep 24 '16 at 10:59
8

That Macvim is obsolete. Use https://github.com/macvim-dev/macvim instead

See the FAQ (https://github.com/b4winckler/macvim/wiki/FAQ#how-can-i-open-files-from-terminal) for how to install the mvim script for launching from the command line

enedil
  • 1,445
  • 4
  • 17
  • 33
Peter Gibson
  • 16,547
  • 5
  • 56
  • 57
  • `MacVim.dmg` installs to `/Applications` ok, but without `mvim` -- that's on github (clone or .zip). – denis Dec 07 '16 at 15:18
  • To set the `mvim` shell script just copy the **mvim** file from the *DMG* and paste to your **Desktop**, then open a **Terminal** and type `cp ~/Desktop/mvim /usr/local/bin` and restart the terminal. That's it! :D Now open folder or files with `mvim .` or `mvim file.txt` – alexventuraio Feb 07 '17 at 04:40
  • After installing the DMG there is an mvim script at `/Applications/MacVim.app/Contents/bin/mvim`. My preference is to create a /usr/local/bin/mvim launcher with `#!/bin/sh` / `exec /Applications/MacVim.app/Contents/bin/mvim "$@"` – AbePralle Nov 13 '18 at 16:14
  • After dmg install, to launch from command line with args: set add path to to the bin of the app. For MacVim, I did the following. export PATH=/Applications/MacVim.app/Contents/bin:$PATH An alias, is another option I tried. alias mvim='/Applications/MacVim.app/Contents/bin/mvim' alias gvim=mvim – zerocog Jan 01 '19 at 05:46