Install / Upgrade Ruby and Rails on Unix-likes

Just had to install a complete ruby-on-rails-stack on a MacOsX box. This guide at Hivelogic comes in handy but I wanted an automated solution that can be easily adopted to new versions. So I was torn between a ruby script (in many cases an older ruby version is installed but you need something new) and a BASH script.Finally the bash version won.Download

# (c) 2007 uberdose.com# This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 3 of the License, or# (at your option) any later version.# This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# GNU General Public License for more details.# You should have received a copy of the GNU General Public License# along with this program.  If not, see .READLINE=5.2RUBY_BASE=1.8RUBY=1.8.6RUBY_GEMS=0.9.2SVN=1.4.3MYSQL_INSTALLATION=/usr/localFAST_MYSQL_BASE=2.7curl -O ftp://ftp.gnu.org/gnu/readline/readline-$READLINE.tar.gztar xzvf readline-$READLINE.tar.gzcd readline-$READLINE./configure –prefix=/usr/localmakesudo make installcd ..curl -O ftp://ftp.ruby-lang.org/pub/ruby/$RUBY_BASE/ruby-$RUBY.tar.gztar xzvf ruby-$RUBY.tar.gzcd ruby-$RUBY./configure –prefix=/usr/local –enable-pthread –with-readline-dir=/usr/local –enable-sharedmakesudo make installsudo make install-doccd ..curl -O http://files.rubyforge.mmmultiworks.com/rubygems/rubygems-$RUBY_GEMS.tgztar xzvf rubygems-$RUBY_GEMS.tgzcd rubygems-$RUBY_GEMSsudo /usr/local/bin/ruby setup.rbcd ..sudo gem install rails –include-dependenciessudo gem install mongrel –include-dependenciessudo gem install capistrano –include-dependenciessudo gem install termios –include-dependenciessudo gem install mysql — –with-mysql-dir=$MYSQL_INSTALLATION/mysqlsudo install_name_tool -change $MYSQL_INSTALLATION/mysql/lib/mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle# comment in if you want svn#curl -O http://subversion.tigris.org/downloads/subversion-$SVN.tar.gz#curl -O http://subversion.tigris.org/downloads/subversion-deps-$SVN.tar.gz#tar xzvf subversion-$SVN.tar.gz#tar xzvf subversion-deps-$SVN.tar.gz#cd subversion-$SVN#./configure –prefix=/usr/local –with-openssl –with-ssl –with-zlib#make#sudo make install#cd ..
Tags: , , , ,

5 Responses to “Install / Upgrade Ruby and Rails on Unix-likes”


uberdose 2.0

L-l-look at you, hacker.