Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitry-ilyashevich/3049446 to your computer and use it in GitHub Desktop.
Save dmitry-ilyashevich/3049446 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 "Prerequisites (iconv)"
if not system("which iconv")
puts "You have to install `libiconv` (http://www.gnu.org/software/libiconv/), first."
exit
end
newblock "Ensure that the right version of Ruby (1.8.7) is set"
if system('which rvm')
if File.exists? ENV['HOME'] +"/.rvm/scripts/rvm"
newblock "Load RVM into session *as a function*"
`source "#{ENV['HOME'] +"/.rvm/scripts/rvm"}"`
elsif File.exists?
newblock "Load RVM into session *as a function* from a root install"
`source "/usr/local/rvm/scripts/rvm"`
else
puts "ERROR: No RVM installation found.\n"
exit
end
`rvm use system`
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 --enable-cscope --enable-pythoninterp --enable-rubyinterp --enable-perlinterp --enable-gui --enable-multibyte"
if `uname -m`.include? "x86_64"
newblock "Your achitecture is x86_64. Set `config.mk` to handle this information."
config = File.read("#{Dir.pwd}/src/auto/config.mk")
r = config.gsub(/.*LDFLAGS.*/,"LDFLAGS = -L. -arch x86_64 -L/usr/local/lib")
File.open("#{Dir.pwd}/src/auto/config.mk", "w") { |file| file.puts r }
end
newblock "Make"
system "make && 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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment