16 9 / 2012

Replacing rvm with rbenv using homebrew

RVM was such a great tool to switch between various rubies and gemsets. But from my last update of the rvm using rvm get head, my shell hangs whenever I change the directory.

So, I thought it is the time to move on with rbenv.

First delete the rvm with the following cmd:

rvm implode

Delete the rvm specific code from your ~/.bashrc or ~/.zshrc or whaterever files related to the shell you’re using.

Then install rbenv and rbenv-gemset via homebrew.

brew update
brew install rbenv rbenv-gemset

Creating a global gemset

echo global > ~/.rbenv-gemsets
gem install bundler
cd project
echo "project-gemset global" > .rbenv-gemsets
bundle install

Whenever you create a gemset and want to share some gems like bundler, install the bundler in global gemset as above and add the global gemset along with the project specific gemset in .rbenv-gemsets file as above.

04 12 / 2011

rvm install ruby woes!!

Sometime when upgrading RVM or just doing a fresh install and try to install Rubies, one might stumble upon a weird problem. I’ve also encountered such situations several times. Specially, when RVM brings breaking changes while updating. The following is the most recurring issue I’ve faced with. So, just documenting for this time so that I don’t have to Google it again.

rvm install ree
ruby-1.8.7-p330 - #fetching
ruby-1.8.7-p330 - #extracting ruby-1.8.7-p330 to /Users/andrew/.rvm/src/ruby-1.8.7-p330
ruby-1.8.7-p330 - #extracted to /Users/andrew/.rvm/src/ruby-1.8.7-p330
ruby-1.8.7-p330 - #configuring
ruby-1.8.7-p330 - #compiling
Error running 'make ', please read /Users/andrew/.rvm/log/ruby-1.8.7-p330/make.log
There has been an error while running make. Halting the installation.

If you do it again, you’ll see the error

Installing Ruby Enterprise Edition from source to: /Users/millisami/.rvm/rubies/ree-1.8.7-2011.03
It appears that the archive has already been extracted. Skipping extract (use --force to force re-download and extract).
ree-1.8.7-2011.03 - #installing 
ERROR: Error running './installer -a /Users/millisami/.rvm/rubies/ree-1.8.7-2011.03  --no-tcmalloc --dont-install-useful-gems -c --with-readline-dir=/usr/local/Cellar/readline/6.2.1', please read /Users/millisami/.rvm/log/ree-1.8.7-2011.03/install.log
ERROR: There has been an error while trying to run the ree installer. Halting the installation.

When you see the log file, you’ll see something at the end of that file:

readline.c: In function ‘username_completion_proc_call’

This error is due to the readline library.

Now you’ve got 2 options. One is to install readline via rvm pkg install readline or if you have homebrew installed, you can install it via brew update; brew install readline.

Then, brew info readline will show the readline path.

So now, you opt for either way.

# if you go via homebrew way
$ rvm remove ree
$ rvm install ree -C --with-readline-dir=/usr/local/Cellar/readline/6.2.1

# if with rvm way
$ rvm get head; rvm reload
$ rvm pkg install readline
$ rvm remove ree
$ rvm install ree --with-readline-dir=$rvm_path/usr



Permalink 10 notes

01 11 / 2011

Installing ruby-debug in ruby 1.9.3 with rvm

blog.wyeworks.com posted a way to install ruby-debug in 1.9.3 in rbenv addressing the details of the problem.

I’m just posting a quick installation in rvm. Install ruby 1.9.3 if you haven’t or skip to the next block.

rvm get head
rvm install ruby-1.9.3-p0
rvm reload
rvm 1.9.3

Now lets install the ruby-debug gem. Follow the below simple steps:

cd ~/tmp
wget http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
wget http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem

$ gem install linecache19-0.5.13.gem 
Building native extensions.  This could take a while...
Successfully installed linecache19-0.5.13
1 gem installed
$ gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p0
Building native extensions.  This could take a while...
Successfully installed ruby-debug-base19-0.11.26
1 gem installed
$ irb
irb(main):001:0> require 'ruby-debug'
=> true


Permalink 3 notes