file 'lib' not found when installing rails - ruby-on-rails

something like this:
gem install rails
Fetching: activesupport-3.0.10.gem (100%)
Fetching: builder-2.1.2.gem (100%)
WARNING: builder-2.1.2 has an invalid nil value for #cert_chain
Fetching: i18n-0.5.0.gem (100%)
Fetching: activemodel-3.0.10.gem (100%)
Fetching: rack-1.2.3.gem (100%)
Fetching: rack-test-0.5.7.gem (100%)
Fetching: rack-mount-0.6.14.gem (100%)
Fetching: tzinfo-0.3.29.gem (100%)
Fetching: abstract-1.0.0.gem (100%)
WARNING: abstract-1.0.0 has an invalid nil value for #cert_chain
Fetching: erubis-2.6.6.gem (100%)
Fetching: actionpack-3.0.10.gem (100%)
Fetching: arel-2.0.10.gem (100%)
Fetching: activerecord-3.0.10.gem (100%)
Fetching: activeresource-3.0.10.gem (100%)
Fetching: mime-types-1.16.gem (100%)
Fetching: polyglot-0.3.2.gem (100%)
Fetching: treetop-1.4.10.gem (100%)
Fetching: mail-2.2.19.gem (100%)
Fetching: actionmailer-3.0.10.gem (100%)
Fetching: thor-0.14.6.gem (100%)
Fetching: railties-3.0.10.gem (100%)
Fetching: bundler-1.0.18.gem (100%)
Fetching: rails-3.0.10.gem (100%)
Successfully installed activesupport-3.0.10
Successfully installed builder-2.1.2
Successfully installed i18n-0.5.0
Successfully installed activemodel-3.0.10
Successfully installed rack-1.2.3
Successfully installed rack-test-0.5.7
Successfully installed rack-mount-0.6.14
Successfully installed tzinfo-0.3.29
Successfully installed abstract-1.0.0
Successfully installed erubis-2.6.6
Successfully installed actionpack-3.0.10
Successfully installed arel-2.0.10
Successfully installed activerecord-3.0.10
Successfully installed activeresource-3.0.10
Successfully installed mime-types-1.16
Successfully installed polyglot-0.3.2
Successfully installed treetop-1.4.10
Successfully installed mail-2.2.19
Successfully installed actionmailer-3.0.10
Successfully installed thor-0.14.6
Successfully installed railties-3.0.10
Successfully installed bundler-1.0.18
Successfully installed rails-3.0.10
23 gems installed
Installing ri documentation for activesupport-3.0.10...
Installing ri documentation for builder-2.1.2...
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for README, skipping
Installing ri documentation for i18n-0.5.0...
Installing ri documentation for activemodel-3.0.10...
Installing ri documentation for rack-1.2.3...
Installing ri documentation for rack-test-0.5.7...
Installing ri documentation for rack-mount-0.6.14...
Installing ri documentation for tzinfo-0.3.29...
Installing ri documentation for abstract-1.0.0...
Installing ri documentation for erubis-2.6.6...
Installing ri documentation for actionpack-3.0.10...
Installing ri documentation for arel-2.0.10...
Installing ri documentation for activerecord-3.0.10...
Installing ri documentation for activeresource-3.0.10...
Installing ri documentation for mime-types-1.16...
Installing ri documentation for polyglot-0.3.2...
Installing ri documentation for treetop-1.4.10...
Installing ri documentation for mail-2.2.19...
Installing ri documentation for actionmailer-3.0.10...
Installing ri documentation for thor-0.14.6...
Installing ri documentation for railties-3.0.10...
Installing ri documentation for bundler-1.0.18...
Installing ri documentation for rails-3.0.10...
file 'lib' not found
Installing RDoc documentation for activesupport-3.0.10...
Installing RDoc documentation for builder-2.1.2...
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for README, skipping
Installing RDoc documentation for i18n-0.5.0...
Installing RDoc documentation for activemodel-3.0.10...
Installing RDoc documentation for rack-1.2.3...
Installing RDoc documentation for rack-test-0.5.7...
Installing RDoc documentation for rack-mount-0.6.14...
Installing RDoc documentation for tzinfo-0.3.29...
Installing RDoc documentation for abstract-1.0.0...
Installing RDoc documentation for erubis-2.6.6...
Installing RDoc documentation for actionpack-3.0.10...
Installing RDoc documentation for arel-2.0.10...
Installing RDoc documentation for activerecord-3.0.10...
Installing RDoc documentation for activeresource-3.0.10...
Installing RDoc documentation for mime-types-1.16...
Installing RDoc documentation for polyglot-0.3.2...
Installing RDoc documentation for treetop-1.4.10...
Installing RDoc documentation for mail-2.2.19...
Installing RDoc documentation for actionmailer-3.0.10...
Installing RDoc documentation for thor-0.14.6...
Installing RDoc documentation for railties-3.0.10...
Installing RDoc documentation for bundler-1.0.18...
Installing RDoc documentation for rails-3.0.10...
file 'lib' not found
and if i run rake db:migrate
it says:
............
rake aborted!
stack level too deep

try this :
sudo gem install rails --no-ri --no-rdoc
and if you want to install RDoc use :
sudo gem install rdoc-data
sudo rdoc-data --install
sudo gem rdoc --all --overwrite
if that doesnt work try this :
sudo apt-get install ruby-dev build-essential

Note, the following also seems to work on Windows 7. (omit the "sudo")
gem install rails --no-ri --no-rdoc

I got similar with gem install rails (Ubuntu 12.04, with RVM)
Installing ri documentation for rails-3.2.13...
file 'lib' not found
Installing RDoc documentation for rails-3.2.13...
file 'lib' not found
installing RDoc and then reinstalling rails solved the problem for me. So:
gem install rdoc
gem install rails

This is still happening on rails-3.2.3.
What appears to work is to install rdoc first. So, with a freshly installed ruby, do:
gem install rdoc
gem install rails

It seems like there are some issues with ree and ruby 1.8.. If you have rvm try use ruby 1.9.2 or any 1.9.
then
gem install rails will work

Related

How to get the example of MSCollectionViewCalendarLayout working

I downloaded the MSCollectionViewCalendarLayout and now I wanted to try out the example. If I open the Example.xcodeproj I only get errors e.g.
Lexical or Preprocessor Issue 'RestKit/RestKit.h' file not found
I tried the tip from the troubleshooting guide to change the project settings but it didn't worked. If I open the Example.xcworkspace I also only get errors.
Seems that the libraries are outdated. Is there a chance to get this project running?
Edit:
Now I tried to install cocoapods. I created a .profile file in my home directory (where Documents, Desktop, Downloads resides in). I put this text into the file
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH
and then I run
gem install cocoapods --user-install
Because he didn't do something (was in the next line in terminal) I pressed q. Then he did something and I got the following warning
WARNING: You don't have /Users/my-user/.gem/ruby/2.0.0/bin in your
PATH, gem executables will not run.
Full output of terminal
Fetching: i18n-0.7.0.gem (100%)
WARNING: You don't have /Users/my-user/.gem/ruby/2.0.0/bin in your PATH,
gem executables will not run.
qSuccessfully installed i18n-0.7.0
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: minitest-5.6.1.gem (100%)
Successfully installed minitest-5.6.1
Fetching: activesupport-4.2.1.gem (100%)
Successfully installed activesupport-4.2.1
Fetching: nap-0.8.0.gem (100%)
Successfully installed nap-0.8.0
Fetching: fuzzy_match-2.0.4.gem (100%)
Successfully installed fuzzy_match-2.0.4
Fetching: cocoapods-core-0.37.1.gem (100%)
Successfully installed cocoapods-core-0.37.1
Fetching: claide-0.8.1.gem (100%)
Successfully installed claide-0.8.1
Fetching: colored-1.2.gem (100%)
Successfully installed colored-1.2
Fetching: xcodeproj-0.24.1.gem (100%)
Successfully installed xcodeproj-0.24.1
Fetching: cocoapods-downloader-0.9.0.gem (100%)
Successfully installed cocoapods-downloader-0.9.0
Fetching: cocoapods-plugins-0.4.2.gem (100%)
Successfully installed cocoapods-plugins-0.4.2
Fetching: cocoapods-try-0.4.4.gem (100%)
Successfully installed cocoapods-try-0.4.4
Fetching: netrc-0.7.8.gem (100%)
Successfully installed netrc-0.7.8
Fetching: cocoapods-trunk-0.6.0.gem (100%)
Successfully installed cocoapods-trunk-0.6.0
Fetching: molinillo-0.2.3.gem (100%)
Successfully installed molinillo-0.2.3
Fetching: escape-0.0.4.gem (100%)
Successfully installed escape-0.0.4
Fetching: cocoapods-0.37.1.gem (100%)
Successfully installed cocoapods-0.37.1
Parsing documentation for i18n-0.7.0
Installing ri documentation for i18n-0.7.0
Parsing documentation for thread_safe-0.3.5
Installing ri documentation for thread_safe-0.3.5
Parsing documentation for tzinfo-1.2.2
Installing ri documentation for tzinfo-1.2.2
Parsing documentation for minitest-5.6.1
Installing ri documentation for minitest-5.6.1
Parsing documentation for activesupport-4.2.1
unable to convert "\x84" from ASCII-8BIT to UTF-8 for lib/active_support/values/unicode_tables.dat, skipping
Installing ri documentation for activesupport-4.2.1
Parsing documentation for nap-0.8.0
Installing ri documentation for nap-0.8.0
Parsing documentation for fuzzy_match-2.0.4
Installing ri documentation for fuzzy_match-2.0.4
Parsing documentation for cocoapods-core-0.37.1
Installing ri documentation for cocoapods-core-0.37.1
Parsing documentation for claide-0.8.1
Installing ri documentation for claide-0.8.1
Parsing documentation for colored-1.2
Installing ri documentation for colored-1.2
Parsing documentation for xcodeproj-0.24.1
Installing ri documentation for xcodeproj-0.24.1
Parsing documentation for cocoapods-downloader-0.9.0
Installing ri documentation for cocoapods-downloader-0.9.0
Parsing documentation for cocoapods-plugins-0.4.2
Installing ri documentation for cocoapods-plugins-0.4.2
Parsing documentation for cocoapods-try-0.4.4
Installing ri documentation for cocoapods-try-0.4.4
Parsing documentation for netrc-0.7.8
Installing ri documentation for netrc-0.7.8
Parsing documentation for cocoapods-trunk-0.6.0
Installing ri documentation for cocoapods-trunk-0.6.0
Parsing documentation for molinillo-0.2.3
Installing ri documentation for molinillo-0.2.3
Parsing documentation for escape-0.0.4
Installing ri documentation for escape-0.0.4
Parsing documentation for cocoapods-0.37.1
Installing ri documentation for cocoapods-0.37.1
19 gems installed
Then I reopened the Xcode example, but I'm still getting the error that RestKit.h can't be found. What I'm doing wrong?
Edit 2:
Now I tried to use pod install in the example directory, but the pod command was not found. So I edited the PATH in .profile to this
export PATH=$GEM_HOME/ruby/2.0.0/bin:$PATH
Then I restarted terminal and run the command again
Analyzing dependencies
Creating shallow clone of spec repo `master` from `https://github.com/CocoaPods/Specs.git`
Fetching podspec for `MSCollectionViewCalendarLayout` from `../`
Downloading dependencies
Installing AFNetworking 1.3.3 (was 1.3.3)
Installing CupertinoYankee 0.1.1 (was 0.1.1)
Installing ISO8601DateFormatterValueTransformer (0.5.0)
Using MSCollectionViewCalendarLayout (0.1.3)
Installing Masonry 0.4.0 (was 0.4.0)
Installing RKValueTransformers (1.0.1)
Installing RestKit 0.22.0 (was 0.22.0)
Installing SOCKit 1.1 (was 1.1)
Installing TransitionKit 2.0.0 (was 2.0.0)
Installing UIColor-HexString (1.0.1)
Generating Pods project
Integrating client project
Afterwards I opened Example.xcworkspace and got the error described by Jakub Vano. Then I unlocked and edited the MASUtilities.h according to this link (commented enum and added the static const).
Now I got the project running!
You need to re-install CocoaPods for Example project:
run pod install in the Example project directory
run the project from the .xcworkspace
There will still be compile errors caused by known issue with Masonry - as mentioned on linked issue, workaround is to replace problematic enum with
typedef float MASLayoutPriority;
static const MASLayoutPriority MASLayoutPriorityRequired = UILayoutPriorityRequired;
static const MASLayoutPriority MASLayoutPriorityDefaultHigh = UILayoutPriorityDefaultHigh;
static const MASLayoutPriority MASLayoutPriorityDefaultMedium = 500;
static const MASLayoutPriority MASLayoutPriorityDefaultLow = UILayoutPriorityDefaultLow;
static const MASLayoutPriority MASLayoutPriorityFittingSizeLevel = UILayoutPriorityFittingSizeLevel;

Ruby on Rails - generate devise

I am new to Ruby on Rails. Just installed it and upgraded rubygems as well. When I type ruby new project I get the following at the end:
Use `bundle show [gemname]` to see where a bundled gem is installed.
run bundle exec spring binstub --all
Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
* bin/rake: spring inserted
* bin/rails: spring inserted
I checked ruby version and it was:
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
Rails version:
Rails 4.2.0
I tried to install devise by adding the following command gem 'devise' to Gemfile, then ran gem install devise to get the following:
Fetching: thor-0.19.1.gem (100%)
Successfully installed thor-0.19.1
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: activesupport-4.2.1.gem (100%)
Successfully installed activesupport-4.2.1
Fetching: rails-deprecated_sanitizer-1.0.3.gem (100%)
Successfully installed rails-deprecated_sanitizer-1.0.3
Fetching: mini_portile-0.6.2.gem (100%)
Successfully installed mini_portile-0.6.2
Fetching: nokogiri-1.6.6.2.gem (100%)
Building native extensions. This could take a while...
Successfully installed nokogiri-1.6.6.2
Fetching: rails-dom-testing-1.0.6.gem (100%)
Successfully installed rails-dom-testing-1.0.6
Fetching: loofah-2.0.1.gem (100%)
Successfully installed loofah-2.0.1
Fetching: rails-html-sanitizer-1.0.2.gem (100%)
Successfully installed rails-html-sanitizer-1.0.2
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: builder-3.2.2.gem (100%)
Successfully installed builder-3.2.2
Fetching: actionview-4.2.1.gem (100%)
Successfully installed actionview-4.2.1
Fetching: rack-1.6.0.gem (100%)
Successfully installed rack-1.6.0
Fetching: rack-test-0.6.3.gem (100%)
Successfully installed rack-test-0.6.3
Fetching: actionpack-4.2.1.gem (100%)
Successfully installed actionpack-4.2.1
Fetching: railties-4.2.1.gem (100%)
Successfully installed railties-4.2.1
Fetching: responders-2.1.0.gem (100%)
Successfully installed responders-2.1.0
Fetching: bcrypt-3.1.10.gem (100%)
Building native extensions. This could take a while...
Successfully installed bcrypt-3.1.10
Fetching: orm_adapter-0.5.0.gem (100%)
Successfully installed orm_adapter-0.5.0
Fetching: warden-1.2.3.gem (100%)
Successfully installed warden-1.2.3
Fetching: devise-3.4.1.gem (100%)
Successfully installed devise-3.4.1
Parsing documentation for thor-0.19.1
Installing ri documentation for thor-0.19.1
Parsing documentation for thread_safe-0.3.5
Installing ri documentation for thread_safe-0.3.5
Parsing documentation for tzinfo-1.2.2
Installing ri documentation for tzinfo-1.2.2
Parsing documentation for i18n-0.7.0
Installing ri documentation for i18n-0.7.0
Parsing documentation for activesupport-4.2.1
Installing ri documentation for activesupport-4.2.1
Parsing documentation for rails-deprecated_sanitizer-1.0.3
Installing ri documentation for rails-deprecated_sanitizer-1.0.3
Parsing documentation for mini_portile-0.6.2
Installing ri documentation for mini_portile-0.6.2
Parsing documentation for nokogiri-1.6.6.2
Installing ri documentation for nokogiri-1.6.6.2
Parsing documentation for rails-dom-testing-1.0.6
Installing ri documentation for rails-dom-testing-1.0.6
Parsing documentation for loofah-2.0.1
Installing ri documentation for loofah-2.0.1
Parsing documentation for rails-html-sanitizer-1.0.2
Installing ri documentation for rails-html-sanitizer-1.0.2
Parsing documentation for erubis-2.7.0
Installing ri documentation for erubis-2.7.0
Parsing documentation for builder-3.2.2
Installing ri documentation for builder-3.2.2
Parsing documentation for actionview-4.2.1
Installing ri documentation for actionview-4.2.1
Parsing documentation for rack-1.6.0
Installing ri documentation for rack-1.6.0
Parsing documentation for rack-test-0.6.3
Installing ri documentation for rack-test-0.6.3
Parsing documentation for actionpack-4.2.1
Installing ri documentation for actionpack-4.2.1
Parsing documentation for railties-4.2.1
Installing ri documentation for railties-4.2.1
Parsing documentation for responders-2.1.0
Installing ri documentation for responders-2.1.0
Parsing documentation for bcrypt-3.1.10
Installing ri documentation for bcrypt-3.1.10
Parsing documentation for orm_adapter-0.5.0
Installing ri documentation for orm_adapter-0.5.0
Parsing documentation for warden-1.2.3
Installing ri documentation for warden-1.2.3
Parsing documentation for devise-3.4.1
Installing ri documentation for devise-3.4.1
Done installing documentation for thor, thread_safe, tzinfo, i18n, activesupport, rails-deprecated_sanitizer, mini_portile, nokogiri, rails-dom-testing, loofah, rails-html-sanitizer, erubis, builder, actionview, rack, rack-test, actionpack, railties, responders, bcrypt, orm_adapter, warden, devise after 21 seconds
23 gems installed
I tried then to run the following command: rails g devise user but I still keep getting the following: Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and rungem pristine --allfor better startup performance. and nothing happens.
How can I proceed?!
As to the warning about rubygems, you can run:
gem update --system
Then make sure you do the following in order:
Add devise to your Gemfile
Run bundle in the command line
Run rails g devise:install in the command line
Run rails generate devise User in the command line.
Hope this helps!
Rubygems update:
gem install rubygems-update
update_rubygems
should help to get rid of that rubygems 2.0.14 warning.

error: failed to build gem native extension when installing rails on mac mountian lion os

I've recently updated to Mountain Lion and re-installed Ruby, but when I try to run a test Rails app, I get an error message that says that "Rails is not currently installed" on my system. I do what it says, type sudo gem install rails and get:
cleared faster_require caches due to new gem install...
Successfully installed rails-3.2.7
1 gem installed
Installing ri documentation for rails-3.2.7...
Installing RDoc documentation for rails-3.2.7...
But when I check to see which rails version is install, here is what I get:
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
I've also tried gem install rails and get:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/aileen/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
creating Makefile
make
compiling generator.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [generator.o] Error 1
Gem files will remain installed in /Users/aileen/.rvm/gems/ruby-1.9.3-p194#rails327/gems/json-1.7.4 for inspection.
Results logged to /Users/aileen/.rvm/gems/ruby-1.9.3-p194#rails327/gems/json-1.7.4/ext/json/ext/generator/gem_make.out
I see that you are using ruby 1.9.3 using rvm on OS X 10.8.2 (Mountain lion)
It's possible that some gems referenced by rails need gcc-4.2 in /usr/bin to build native estension.
In Mountain Lion , even after installing Xcode 4.5 CLI tools ( opening the menu XCode - Preferences..Download -> Command Line Tools ) you get /usr/bin/gcc but not /usr/bin/gcc-4.2; unfortunately the build process of some native extension relies on /usr/bin/gcc-4.2
However I just installed rails smoothly on an environment such as your.
I previously fixed the environment as discussed in the Carina C. Zona's blog post: Fix for “make: /usr/bin/gcc-4.2: No such file or directory”, that is:
make sure you have installed Homebrew
brew --version
should report 0.9.3 or greater
if you have not brew than follow these instrunctions to install it
if you have a older version then update it:
brew update
now you can install gcc-4.2 and create a symbolink link where is aspected by the build system
brew tap homebrew/dupes
brew install apple-gcc42
sudo ln -s /usr/local/bin/gcc-4.2 /usr/bin/gcc-4.2
now you're ready to successfully install rails
gem install rails
You should get output something like this
Fetching: i18n-0.6.1.gem (100%)
Fetching: activesupport-3.2.8.gem (100%)
Fetching: builder-3.0.4.gem (100%)
Fetching: activemodel-3.2.8.gem (100%)
Fetching: rack-cache-1.2.gem (100%)
Fetching: rack-test-0.6.2.gem (100%)
Fetching: journey-1.0.4.gem (100%)
Fetching: hike-1.2.1.gem (100%)
Fetching: sprockets-2.1.3.gem (100%)
Fetching: erubis-2.7.0.gem (100%)
Fetching: actionpack-3.2.8.gem (100%)
Fetching: arel-3.0.2.gem (100%)
Fetching: tzinfo-0.3.34.gem (100%)
Fetching: activerecord-3.2.8.gem (100%)
Fetching: activeresource-3.2.8.gem (100%)
Fetching: polyglot-0.3.3.gem (100%)
Fetching: treetop-1.4.12.gem (100%)
Fetching: mail-2.4.4.gem (100%)
Fetching: actionmailer-3.2.8.gem (100%)
Fetching: rack-ssl-1.3.2.gem (100%)
Fetching: railties-3.2.8.gem (100%)
Fetching: rails-3.2.8.gem (100%)
Successfully installed i18n-0.6.1
Successfully installed activesupport-3.2.8
Successfully installed builder-3.0.4
Successfully installed activemodel-3.2.8
Successfully installed rack-cache-1.2
Successfully installed rack-test-0.6.2
Successfully installed journey-1.0.4
Successfully installed hike-1.2.1
Successfully installed sprockets-2.1.3
Successfully installed erubis-2.7.0
Successfully installed actionpack-3.2.8
Successfully installed arel-3.0.2
Successfully installed tzinfo-0.3.34
Successfully installed activerecord-3.2.8
Successfully installed activeresource-3.2.8
Successfully installed polyglot-0.3.3
Successfully installed treetop-1.4.12
Successfully installed mail-2.4.4
Successfully installed actionmailer-3.2.8
Successfully installed rack-ssl-1.3.2
Successfully installed railties-3.2.8
Successfully installed rails-3.2.8
22 gems installed
Installing ri documentation for i18n-0.6.1...
Building YARD (yri) index for i18n-0.6.1...
Installing ri documentation for activesupport-3.2.8...
Building YARD (yri) index for activesupport-3.2.8...
Installing ri documentation for builder-3.0.4...
Building YARD (yri) index for builder-3.0.4...
Installing ri documentation for activemodel-3.2.8...
Building YARD (yri) index for activemodel-3.2.8...
Installing ri documentation for rack-cache-1.2...
Building YARD (yri) index for rack-cache-1.2...
Installing ri documentation for rack-test-0.6.2...
Building YARD (yri) index for rack-test-0.6.2...
Installing ri documentation for journey-1.0.4...
Building YARD (yri) index for journey-1.0.4...
Installing ri documentation for hike-1.2.1...
Building YARD (yri) index for hike-1.2.1...
Installing ri documentation for sprockets-2.1.3...
Building YARD (yri) index for sprockets-2.1.3...
Installing ri documentation for erubis-2.7.0...
Building YARD (yri) index for erubis-2.7.0...
Installing ri documentation for actionpack-3.2.8...
Building YARD (yri) index for actionpack-3.2.8...
Installing ri documentation for arel-3.0.2...
Building YARD (yri) index for arel-3.0.2...
Installing ri documentation for tzinfo-0.3.34...
Building YARD (yri) index for tzinfo-0.3.34...
Installing ri documentation for activerecord-3.2.8...
Building YARD (yri) index for activerecord-3.2.8...
Installing ri documentation for activeresource-3.2.8...
Building YARD (yri) index for activeresource-3.2.8...
Installing ri documentation for polyglot-0.3.3...
Building YARD (yri) index for polyglot-0.3.3...
Installing ri documentation for treetop-1.4.12...
Building YARD (yri) index for treetop-1.4.12...
Installing ri documentation for mail-2.4.4...
Building YARD (yri) index for mail-2.4.4...
Installing ri documentation for actionmailer-3.2.8...
Building YARD (yri) index for actionmailer-3.2.8...
Installing ri documentation for rack-ssl-1.3.2...
Building YARD (yri) index for rack-ssl-1.3.2...
Installing ri documentation for railties-3.2.8...
Building YARD (yri) index for railties-3.2.8...
Installing ri documentation for rails-3.2.8...
Building YARD (yri) index for rails-3.2.8...
Installing RDoc documentation for i18n-0.6.1...
Installing RDoc documentation for activesupport-3.2.8...
Installing RDoc documentation for builder-3.0.4...
Installing RDoc documentation for activemodel-3.2.8...
Installing RDoc documentation for rack-cache-1.2...
Installing RDoc documentation for rack-test-0.6.2...
Installing RDoc documentation for journey-1.0.4...
Installing RDoc documentation for hike-1.2.1...
Installing RDoc documentation for sprockets-2.1.3...
Installing RDoc documentation for erubis-2.7.0...
Installing RDoc documentation for actionpack-3.2.8...
Installing RDoc documentation for arel-3.0.2...
Installing RDoc documentation for tzinfo-0.3.34...
Installing RDoc documentation for activerecord-3.2.8...
Installing RDoc documentation for activeresource-3.2.8...
Installing RDoc documentation for polyglot-0.3.3...
Installing RDoc documentation for treetop-1.4.12...
Installing RDoc documentation for mail-2.4.4...
Installing RDoc documentation for actionmailer-3.2.8...
Installing RDoc documentation for rack-ssl-1.3.2...
Installing RDoc documentation for railties-3.2.8...
Installing RDoc documentation for rails-3.2.8...
#Franco is correct: the "native extension" build scripts expect /usr/bin/gcc-4.2, which does not exist in OS X Mountain Lion.
If you upgraded to Mountain Lion from a prevoius OS X version, then you may already have gcc. In that case, just create a symlink to gcc: sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
If you have a fresh install of Mountain Lion, then you may not have gcc at all. In that case, you would need to install gcc as #Franco explains.
This is not specifically a "rails" gem issue. Any gem that builds "native extensions" fails:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. [...]
You have to install development tools first.
In my case, I was trying to install octopress, which depends on something called RedCloth.
I ran into this issue as well, with Mountain Lion. The gem that was failing installation was json. To fix it, I installed the xcode CLI tools and then just symlinked the installed gcc (i686-apple-darwin11-llvm-gcc-4.2) as /usr/bin/gcc-4.2. Once this was done, it just worked.
While trying to install another gem, I ran into a similar issue where the native build step complained about missing g++-4.2. I symlinked this exactly the same as I did with gcc-4.2 above, and it worked.
UPDATE: OSX Mavericks with latest RVM
With the latest OSX 10.9 and latest RVM, these issues seem to have gone away. So, time to upgrade.
Try working through this first
He assumes you already have homebrew. If you don't you can get it from here

Searchlogic gem install -> installs gems that aren't searchlogic (and then doesn't install searchlogic)

% gem install searchlogic -v2.4.28
Fetching: arel-2.2.1.gem (100%)
Fetching: tzinfo-0.3.31.gem (100%)
Successfully installed activemodel-3.1.3
Successfully installed arel-2.2.1
Successfully installed tzinfo-0.3.31
3 gems installed
Installing ri documentation for activemodel-3.1.3...
Installing ri documentation for arel-2.2.1...
Installing ri documentation for tzinfo-0.3.31...
Installing RDoc documentation for activemodel-3.1.3...
Installing RDoc documentation for arel-2.2.1...
Installing RDoc documentation for tzinfo-0.3.31...
.... what is going on here?
shouldn't search logic be installed, and not these... gems I don't need?
This looks like it's installing the dependencies for the gem, as it depends on activerecord and these are the dependencies for the activerecord gem. You should check to see if the gem is not already installed.

Ruby on Rails: can't update with gem update

Running gem -v gives:
1.8.11
Running gem update:
Updating installed gems
Updating actionmailer
Fetching: activesupport-3.1.3.gem (100%)
Fetching: activemodel-3.1.3.gem (100%)
Fetching: sprockets-2.0.3.gem (100%)
Fetching: actionpack-3.1.3.gem (100%)
Fetching: actionmailer-3.1.3.gem (100%)
Successfully installed activesupport-3.1.3
Successfully installed activemodel-3.1.3
Successfully installed sprockets-2.0.3
Successfully installed actionpack-3.1.3
Successfully installed actionmailer-3.1.3
Updating activerecord
Fetching: activerecord-3.1.3.gem (100%)
Successfully installed activerecord-3.1.3
Updating activeresource
Fetching: activeresource-3.1.3.gem (100%)
Successfully installed activeresource-3.1.3
Updating childprocess
Fetching: childprocess-0.2.3.gem (100%)
Successfully installed childprocess-0.2.3
Updating columnize
Fetching: columnize-0.3.5.gem (100%)
Successfully installed columnize-0.3.5
Updating cucumber
Fetching: gherkin-2.6.8.gem (100%)
Building native extensions. This could take a while...
Fetching: cucumber-1.1.3.gem (100%)
(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
Thank you for installing cucumber-1.1.3.
Please be sure to read http://wiki.github.com/cucumber/cucumber/upgrading
for important information about this release. Happy cuking!
(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
Successfully installed gherkin-2.6.8
Successfully installed cucumber-1.1.3
Updating devise
Fetching: devise-1.5.2.gem (100%)
Successfully installed devise-1.5.2
Updating factory_girl
Fetching: factory_girl-2.3.2.gem (100%)
Successfully installed factory_girl-2.3.2
Updating jquery-rails
Fetching: jquery-rails-1.0.19.gem (100%)
Successfully installed jquery-rails-1.0.19
Updating json
Fetching: json-1.6.3.gem (100%)
Building native extensions. This could take a while...
Successfully installed json-1.6.3
Updating json_pure
Fetching: json_pure-1.6.3.gem (100%)
Successfully installed json_pure-1.6.3
Updating multi_json
Fetching: multi_json-1.0.4.gem (100%)
Successfully installed multi_json-1.0.4
Updating passenger
Fetching: passenger-3.0.11.gem (100%)
Successfully installed passenger-3.0.11
Updating rails
Fetching: railties-3.1.3.gem (100%)
Fetching: rails-3.1.3.gem (100%)
Successfully installed railties-3.1.3
Successfully installed rails-3.1.3
Updating rubyzip
Fetching: rubyzip-0.9.5.gem (100%)
Successfully installed rubyzip-0.9.5
Updating sass
Fetching: sass-3.1.11.gem (100%)
Successfully installed sass-3.1.11
Updating selenium-webdriver
Fetching: selenium-webdriver-2.14.0.gem (100%)
Successfully installed selenium-webdriver-2.14.0
Gems updated: activesupport, activemodel, sprockets, actionpack, actionmailer, activerecord, activeresource, childprocess, columnize, gherkin, cucumber, devise, factory_girl, jquery-rails, json, json_pure, multi_json, passenger, railties, rails, rubyzip, sass, selenium-webdriver
Installing ri documentation for activesupport-3.1.3...
Installing ri documentation for activemodel-3.1.3...
Installing ri documentation for sprockets-2.0.3...
Installing ri documentation for actionpack-3.1.3...
Installing ri documentation for actionmailer-3.1.3...
Installing ri documentation for activerecord-3.1.3...
Installing ri documentation for activeresource-3.1.3...
Installing ri documentation for childprocess-0.2.3...
Installing ri documentation for columnize-0.3.5...
Installing ri documentation for gherkin-2.6.8...
Installing ri documentation for cucumber-1.1.3...
Installing ri documentation for devise-1.5.2...
Installing ri documentation for factory_girl-2.3.2...
Installing ri documentation for jquery-rails-1.0.19...
Installing ri documentation for json-1.6.3...
Installing ri documentation for json_pure-1.6.3...
Installing ri documentation for multi_json-1.0.4...
Installing ri documentation for passenger-3.0.11...
Installing ri documentation for railties-3.1.3...
Installing ri documentation for rails-3.1.3...
Installing ri documentation for rubyzip-0.9.5...
Installing ri documentation for sass-3.1.11...
Installing ri documentation for selenium-webdriver-2.14.0...
ERROR: While executing gem ... (ArgumentError)
marshal data too short
What should i do ?
Try making a backup copy of your ~/.gems folder, then purging it, and running the command again.
Ref: http://keyj.wordpress.com/2009/03/20/error-with-rubygems-marshal-data-too-short/
Did you mean:
gem update --system
Or you wanted to update specific gem:
gem update rails

Resources