Problem with Ruby, Rails, ZSH and RVM - ruby-on-rails

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

Related

Rails issue starting server on Mountain Lion "[BUG] Segmentation fault ruby 1.8.7 (2012-02-08 patchlevel 358..."

I'm really new to coding so please pardon my inexperience.
I'm following Michael Hartl's tutorial, and I'm stuck on the part where you're supposed to make a server.
The instruction is to simply type:
$ rails server
The error message I'm getting is:
/Users/name/.rvm/gems/ruby-1.9.3-p429/gems/sqlite3-1.3.5/lib/sqlite3/sqlite3_native.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
I'm confused as to why it says ruby 1.8.7 even though i'm using 1.9.3. Please help me fix this problem. I'm a complete beginner so please keep it simple.
you probably didn't bundle your gem before running your server. Try
bundle install
then run rails s

Rails Server won't start after Ruby upgrade - Segmentation Fault

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

Rails Starting Up With Wrong Version of Ruby

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

Sqlite3 problem with RVM

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.

Ruby on Rails undefined method `camelize' for "app":String

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.

Resources