I had a project with rails 3 and ruby 1.8.7 then I installed rvm and ruby 1.9.2 now when I try to run script/rails console in the project folder, I get this error with SQLlite
/home/khaled/.rvm/gems/ruby-1.9.2-p290/gems/sqlite3-1.3.3/lib/sqlite3/sqlite3_native.so: [BUG] Segmentation fault
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]Aborted
Help ??
First off, If you are using Rails 3 it's rails console, rails server, not script/console, script/server
Second, see if rvm is working properly with rvm in you console. If you get good output then you are ok. If not you need to install rvm properly here.
Switch versions of ruby with rvm use ruby-1.9.3xxxx. You can get the ruby versions with rvm list. Try install different versions and see if that helps out.
Related
After upgrading my Ruby to 1.9.3-p429, I tried to start the Rails server. It told me rails was not installed so, I boldly did a 'gem install rails'. Now when I try to start the server, I'm getting this:
andrunix#amp-laptop~/code/madrilla$ rails s
/Users/andrunix/.rvm/gems/ruby-1.9.3-p429/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
Abort trap: 6
I have no idea why that says, "ruby 1.8.7" in that output. Perhaps that's a clue to my problem.
But anyway, super frustrated at this point.
And by the way, this is on OS X.
Help me please!
Try to set the version you've installed as the default for your whole system:
rvm --default use ruby-1.9.3-p429
TLDR: How do I force a rails app to use the correct ruby interpreter?
Hello,
Something hosed parts of my Ruby 1.9.2p290 install (certain classes just went missing one day), so I removed it and attempted to reinstall the environment.
I'm running on Snow Leopard.
Ruby 1.9.2 was installed from source. (I tried to install via MacPorts and it would fail). I am not keen on RVM as I use bundler and I seem to recall some problems with how bundler and RVM interact, though from what I can tell RVM works.
After reinstalling a few gems I noticed they were being placed in a gem folder for Ruby 1.8. "This is weird," I thought.
Starting up the rails app, I notice a lot of weird exceptions being thrown regarding syntax. After printing RUBY_VERSION to stdout, I noticed that the Rails app is running 1.8.7.
which ruby shows only one ruby interpreter:
$ which ruby
/usr/bin/ruby
$ /usr/bin/ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
If I open up Activity Monitor, the ruby process from the Rails app lives at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby, which I believe is the ruby interpreter that OSX shipped with.
I haven't found any information on completely purging Ruby from OSX. I would love to do that then simply install ruby from source.
It seems there are two problems:
Rails is running a ruby interpreter that I have no idea how it is calling, when I need it to run the 1.9.2 interpreter installed from source
gems are being installed in a 1.8 folder, I suspect because gem thinks its running under 1.8
How do I fix this?
Thank you,
Tom
I guess the best way to overcome this issue is using rvm to handle your Ruby and Rails environments through 'gemset's.
I had the same issue and I use gemsets now without a problem.
This is the article which I got things working:
http://stjhimy.com/posts/10-five-quick-steps-to-set-up-rvm-with-rails-2-and-rails3
When I go into my rails app folder and write:
which ruby
I get this:
/Users/gugguson/.rvm/rubies/ruby-head/bin/ruby
When I write:
ruby -v
I get this:
ruby 1.9.3dev (2010-09-25 trunk 29341) [x86_64-darwin10.4.0]
Hovever when I run my app with:
rails s
I get an error indication it is using ruby 1.8.7 my app is using:
/Users/gugguson/.rvm/gems/ruby-head/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]
zsh: abort rails s
Do you know what can be causing this?
You might be using system installed rails script, make sure that you use rails installed inside rvm and
head $(which rails)
starts with
#!/Users/gugguson/.rvm/rubies/ruby-head/bin/ruby
I installed Rails 3 by following this gist: http://gist.github.com/296055
But when I try "rails" in terminal I get the following error:
/Users/yves/.rvm/gems/ruby-1.9.2-head/gems/activerecord-3.0.0/lib/rails: Is a directory - /Users/yves/.rvm/gems/ruby-1.9.2-head/gems/activerecord-3.0.0/lib/rails (Errno::EISDIR)
from /usr/bin/rails:19:in `load'
from /usr/bin/rails:19
Any ideas?
UPDATE
Ok, I figured out something. I can run the correct rails by going directly to the right executable:
/Users/yves/.rvm/gems/ruby-1.9.2-head/gems/rails-3.0.0/bin/rails
Apparantly my "rails" command is still linked another version, the one in usr/local/bin
How can I change this?
Check out my answer on this other question:
(if this works for you, we should mark this as a duplicate question. But I don't have enough points to do that myself)
--
Older versions of rvm had a bug that can cause your ruby versions to get crosswired because the OS can cache executable paths for the which command (particularly if you are using zsh). See this long, detailed, mind blowing post by Yehuda Katz on the subject.
What I had to do this morning:
rvm update && rvm reload # update rvm
rvm gemset delete rails3 # delete old gemset
rvm install 1.9.2
rvm use 1.9.2
rvm gemset create rails3
rvm use 1.9.2#rails3
which ruby # check to be sure the ruby interpretter is properly set to 1.9.2
hash -r # if ruby interpretter is not pointing to 1.9.2
gem install rails
which rails # check to be sure we are using rvm version of rails
I followed this article and was able to install everything. The article is in Russian, but you should be able to translate it to desired language via Google translate.
I bumped into 'no ssl' error but this article explains how to resolve it as well (at the bottom).
My setup now is:
RVM
Ruby 1.8.7 + Rails 2.3.8
Ruby 1.9.2 + Rails 3.0.0
Hope this will help you.
I just tried to play with Ruby on Rails on Snow Leopard.
I was following this tutorial:
http://developer.apple.com/tools/rubyonrails.html
Whatever I try to do with rails I end up with:
MacBook-Pro-lm:~ lukasz$ rails blog
**undefined method `camelize' for "app":String**
MacBook-Pro-lm:~ lukasz$ rails --help
**undefined method `camelize' for "app":String**
Really basic things... however - verbosing rails works:
MacBook-Pro-lm:bin lukasz$ rails -v
Rails 2.3.5
MacBook-Pro-lm:~ lukasz$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10]
MacBook-Pro-lm:bin lukasz$ gem -v
1.3.7
So it seems I have installed and upgarded ruby (using macports), rubygems and rails successfully (according to terminal). There are also few other packages installed to support we development like passenger and mysql5, etc...
I can find ruby installed in the
/opt/local/bin directory. My environment PATH variable is:
PATH=/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
The is something fishy going on. It must be some stupid basic problem. Google says that there could be a problem with ruby-iconv library but I can not find/install this package using port or gem commands.
Plese help.... what am I missing here?
You might want to try to check where the gem was installed:
gem list -d rails
Compare the gem installation directory with other gems that rails needs. It seems to me that it is a ruby gems issue. Make sure all the gems was installed with macports version of rubygems. It is not possible to mix and match.
Hopefully it helps.