Skip to content

Instantly share code, notes, and snippets.

@pengwynn
Forked from mattsacks/install.rb
Created July 27, 2011 17:41
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save pengwynn/1109948 to your computer and use it in GitHub Desktop.
Save pengwynn/1109948 to your computer and use it in GitHub Desktop.
Script to install Vim 7.3 with ruby support for Mac OS X Lion
# requires root permissions in /usr/bin/
star = String.new
8.times { star += "*" }
Star = "\n#{star * 3}\n"
def newblock string
puts "\n#{Star}#{string}#{Star}\n"
end
newblock " move to /tmp/"
Dir.chdir("/tmp\/")
pwd = Dir.pwd
newblock "curl & expand vim73 source"
system 'curl ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2 | tar -xz'
Dir.chdir"#{pwd}/vim73/"
newblock = "Start configure"
system "./configure"
newblock "Start options configuration"
# Will complain about xterm and clipboard - but they're enabled so...
system "./configure --with-features=huge --enable-cscope --enable-pythoninterp --enable-rubyinterp --enable-perlinterp --enable-gui=macvim --enable-multibyte --enable-clipboard=yes --enable-xterm_clipboard=yes"
newblock "Set arch in LDFlags"
arch = "-arch x86_64"
config = File.read("#{Dir.pwd}/src/auto/config.mk")
r = config.gsub(/.*LDFLAGS.*/,"LDFLAGS = -L. #{arch} -L/usr/local/lib")
File.open("#{Dir.pwd}/src/auto/config.mk", "w") { |file| file.puts r }
newblock "Make"
system "make"
newblock "new vim is in /tmp/vim73/src/vim. please verify by typing /tmp/vim73/src/vim --version\n
you may symlink it to /usr/bin if you'd like. 'sudo make install' will install to /usr/local/share/"
newblock "sudo Make"
system "sudo make install"
newblock "old vim symlink moved to /usr/bin/vim.old"
system "sudo mv /usr/bin/vim /usr/bin/vim.old"
system "sudo ln -s /usr/local/bin/vim /usr/bin/vim"
@sirupsen
Copy link

When running I get: ld: library not found for -lruby.1.9.1, any ideas?

Edit: rm -rf /tmp/vim73 && rvm system && ruby vim.rb

@pengwynn
Copy link
Author

hmm. What flavor of OSX? I ran on Lion as sudo.

@sirupsen
Copy link

Oops, wasn't clear from the edit but I figured out the solution, I simply had to compile it under system Ruby.

@david-kerins
Copy link

Still getting an arch error.

ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [vim] Error 1
make: *** [first] Error 2

I see the change in the config.mk file, but no love.

$ grep LDFLAG config.mk
LDFLAGS = -L. -arch x86_64 -L/usr/local/lib

Any ideas or comments appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment