Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rvm conflit with sqlite3

$: /Users/dev/.rvm/gems/ruby-1.9.2-head@rails3/gems/sqlite3-ruby-1.3.1/lib/sqlite3/sqlite3_native.bundle: [BUG] Segmentation fault ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]

Abort trap

It's seem that ruby is not the correct version (1.8.7) but :

$: ruby - v
$: ruby 1.9.2dev (2010-07-15 revision 28653) [x86_64-darwin10.4.0]



$: gem list

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.0.beta4, 3.0.0.beta3)
actionpack (3.0.0.beta4, 3.0.0.beta3)
activemodel (3.0.0.beta4, 3.0.0.beta3)
activerecord (3.0.0.beta4, 3.0.0.beta3)
activeresource (3.0.0.beta4, 3.0.0.beta3)
activesupport (3.0.0.beta4, 3.0.0.beta3)
arel (0.4.0, 0.3.3)
builder (2.1.2)
bundler (0.9.26)
erubis (2.6.6)
i18n (0.4.1, 0.3.7)
mail (2.2.5)
memcache-client (1.8.5)
mime-types (1.16)
polyglot (0.3.1)
rack (1.1.0)
rack-mount (0.6.9)
rack-test (0.5.4)
rails (3.0.0.beta4, 3.0.0.beta3)
railties (3.0.0.beta4, 3.0.0.beta3)
rake (0.8.7)
rdoc (2.5.9)
sqlite3-ruby (1.3.1)
text-format (1.0.0)
text-hyphen (1.0.0)
thor (0.13.8)
treetop (1.4.8)
tzinfo (0.3.22)
will_paginate (3.0.pre)

more info :

$: ~ dev$ ruby -v
ruby 1.9.2dev (2010-07-15 revision 28653) [x86_64-darwin10.4.0]
$ :~ dev$ rails -v



/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in `gem'
from /usr/bin/rails:18

Any ideas ?

Thanks very much :)

like image 467
akam Avatar asked Jul 22 '10 10:07

akam


2 Answers

Had the same issue after moving to 1.9.2p0, but restarting the console on Snow Leopard did the trick. Seems rvm might have gotten confused.

like image 62
Codewerks Avatar answered Sep 20 '22 09:09

Codewerks


Same problem for me on Snow Leopard; even though under rvm 1.9.2@rails3, I can see correct rails version number.

I have to use following command to use rails command:

ruby which rails g scaffold User name:string bio:text

Any solution?

I've finally found the reason. Looks like gem install rails is not managed to install the proper binary for rails in rvm. And rails is still references /usr/bin/rails, which have a #! line point to System ruby.

You can see it with:

head -1 `which rails`

which returns:

#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

Change that to:

#!/usr/bin/env ruby

will fix the problem. I don't know if this problem affect other executable scripts gem installs, but why gem not install rails to rvm's own bin path is a mystery to me. Anyway, this workaround do the dirty for me.

like image 29
venj Avatar answered Sep 18 '22 09:09

venj