views:

201

answers:

4

Hi

$: /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 :)

+1  A: 

I don't know how this has happened in your case but it looks to me that Rails has tried to run with your system installed Ruby but is loading gems from a 1.9.2 load path. Very odd.

You see the correct Ruby version in your shell (RVM has precedence in the local path) but that's not apparently what Rails is being started with.

Check to see you how you are starting Rails and that you don't have paths or links or aliases messed up between Ruby versions

bjg
+1  A: 

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.

venj
I had the same issue. I created the rails application using system gems and ruby and then entered the rails app and created an .rvmrc. I believe this is how my issue arose.
Jonathan R. Wallace
+1  A: 

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.

Codewerks
A: 

+1 Codewerks

Restarting the console worked for me as well.

Asif Sheikh