Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to compile vim on OS X?

Following this writeup...

The compiled binary seems to work fine, but the installed binary fails (when running make install).

It seems to be failing on this step:

...
generating help tags
/usr/local/bin/vim -u NONE -esX -c "helptags ++t ." -c quit
dyld: Symbol not found: _environ
  Referenced from: /Users/neezer/.rvm/rubies/ruby-1.9.2-p0/lib/libruby.1.9.1.dylib
  Expected in: flat namespace
 in /Users/neezer/.rvm/rubies/ruby-1.9.2-p0/lib/libruby.1.9.1.dylib
make[2]: *** [vimtags] Trace/BPT trap
make[1]: [installrtbase] Error 2 (ignored)

I used this to configure:

./configure --prefix=/usr/local --enable-rubyinterp --enable-gui=no --disable-gpm

Like I said, I think it compiled correctly, because I can run ./src/vim after make just fine (no errors). But when I try to run the installed version after make install in /usr/local/bin/vim, I get this (mirrors above):

dyld: Symbol not found: _environ
  Referenced from: /Users/neezer/.rvm/rubies/ruby-1.9.2-p0/lib/libruby.1.9.1.dylib
  Expected in: flat namespace
 in /Users/neezer/.rvm/rubies/ruby-1.9.2-p0/lib/libruby.1.9.1.dylib
[1]    13175 trace trap  vim

Running which vim verifies that it is trying to load the new binary in /usr/local/bin/vim.

My current version of Ruby is ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.5.0] via RVM.

What's happening here?

And no: I don't want to just use MacVim instead...

like image 349
neezer Avatar asked May 24 '11 17:05

neezer


People also ask

Does vim work on Mac?

VIM allows you to create and edit text files on your Mac. It is wonderful, fast and free.

Where is vim installed on Mac?

The path used by macOS's default vim install is /usr/share/vim/vimrc . If you aren't using the default, here's the easiest way to discover where it is: :scriptnames . The first line should be the system vimrc .


2 Answers

Says right in the blog post:

you’ve probably fallen prey to a (currently) not very well documented issue: Vim 7.2 does not support the integration of Ruby 1.9.x on Snow Leopard.

There's more information available in this ticket.

But in summary, you have to link against Ruby 1.8.7, which is the version that ships with Snow Leopard anyway.

like image 165
mipadi Avatar answered Oct 19 '22 08:10

mipadi


Vim can't be compiled with Ruby 1.9.X (may be fixed in the future). You have to compile it with Ruby 1.8.X, if you want to use ruby integration.

If you use rbenv instead of rvm, you can change to ruby 1.8.7 or disable rbenv in your .zshenv or .bash_profile file, recompile vim and enable your current ruby again. This should work for OSX 10.6 too. I've tested this solution on OSX 10.7 and 10.8 only.

For zsh and rbenv:

# disable in your .zshenv for compile time. Just comment it out for comile time.
# eval "$(rbenv init -)"

For bash and rbenv:

# disable in .bash_profile or .bashrc for compile time. Just comment it out for comile time.
# eval "$(rbenv init -)"

For rvm, you can switch to system ruby (osx), recompile and switch back

rvm use system
brew uninstall vim
brew install vim
rvm use 1.9.3
like image 33
Fa11enAngel Avatar answered Oct 19 '22 06:10

Fa11enAngel