Blogged by Ujihisa. Standard methods of programming and thoughts including Clojure, Vim, LLVM, Haskell, Ruby and Mathematics written by a Japanese programmer. github/ujihisa

Friday, June 5, 2009

Installing Ruby 1.9.1 By Source Code

I use both stable version and edge version of ruby. The stable one, ruby 1.8.7, is installed by MacPorts. The edge ruby 1.9.2dev is installed by the source from svn trunk via git-svn. While 1.8.7 is in /opt/local/bin/ruby, 1.9.2dev is in a user area ~/git/ruby-trunk/ruby19/bin/ruby.

Today I came across to use ruby 1.9.1 for checking some special cases. I installed it in the following way:

$ mkdir ~/rubies
$ mkdir ~/rubies/src
$ cd ~/rubies/src
$ svn co
$ cd ruby_1_9_1
$ autoconf
$ ./configure --program-suffix=191 --prefix=/Users/ujihisa/rubies --disable-install-doc

$ make && make install

And then write it on your ~/.zshrc:

export PATH=$PATH:~/rubies/bin

Note that:

  • configure's --prefix option can accept only an absolute path.

You can install other versions of ruby by the almost same procedure, and run by like ruby191.

No comments:

Post a Comment