Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Segmentation fault when running 'rails s'

After doing a bundle install, I run 'rails s' it runs into this error.

$ rails s

/Users/XXXX/.rvm/gems/ruby-1.8.7-p352@r3/gems/json-1.5.3/ext/json/ext/json/ext/parser.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin10.8.0]

Abort trap

Any help would be greatly appreciated. Thanks!

like image 663
nbucciarelli Avatar asked Aug 19 '11 01:08

nbucciarelli


People also ask

Why am I getting a segmentation fault?

In practice, segfaults are almost always due to trying to read or write a non-existent array element, not properly defining a pointer before using it, or (in C programs) accidentally using a variable's value as an address (see the scanf example below).

What is segmentation fault and when does it happen?

A segmentation fault occurs when a program attempts to access a memory location that it is not allowed to access, or attempts to access a memory location in a way that is not allowed (for example, attempting to write to a read-only location, or to overwrite part of the operating system).


2 Answers

  1. rvm gemset empty
  2. rvm use ree@my-gemset
  3. gem install bundler
  4. bundle install

This solved the issue for me. Must be some extension got compiled against the wrong version of Ruby (in my case). Hope it works for you!

If you are not using RVM, I found this command to uninstall all gems:

  1. 'gem list | cut -d" " -f1 | xargs gem uninstall -aIx'
  2. gem install bundler
  3. bundle install
like image 81
user959751 Avatar answered Oct 21 '22 03:10

user959751


Your gemset is not compiled for the version of ruby you are using. I found this worked for me:

  1. rvm gemset empty
  2. rvm gemset create your_gem_set_name
  3. rvm use 1.8.7@your_gem_set_name --default
  4. bundle install
like image 42
Leo Ajc Avatar answered Oct 21 '22 05:10

Leo Ajc