Gem libxml-ruby (1.1.4) installs but fails on runtime - ruby-on-rails

I'm trying to run one quite old Rails application on Mavericks where one of the requirements are:
- Ruby ree-1.8.7-2009.10
- Rails 3.0.0
- libxml-ruby 1.1.4 (that's the latest version compatible with the rest of the gems.
I have latest libxml2 package installed. It's version from Homebrew (2.9.1).
To install this gem I used following command:
$ CC=gcc-4.2 gem install libxml-ruby -v '1.1.4'
Output suggested success:
Building native extensions. This could take a while...
Successfully installed libxml-ruby-1.1.4
1 gem installed
though when I try run some rake task, i.e. creating database
bundle exec rake db:create
I get following error:
$ bundle exec rake db:create [ree-1.8.7-2009.10#mygemset]
rake aborted!
dlsym(0x7ffa2d83bbe0, Init_libxml_ruby): symbol not found - /Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/libxml-ruby-1.1.4/lib/libxml_ruby.bundle
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/libxml-ruby-1.1.4/lib/libxml_ruby.bundle
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in `require'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:597:in `new_constants_in'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in `require'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/libxml-ruby-1.1.4/lib/libxml.rb:9
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in `require'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in `require'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:597:in `new_constants_in'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in `require'
/Users/myuser/Developer/my-project/vendor/private_gems/restful_authentication-1.4.9/lib/sso/sso.rb:3
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in `require'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in `require'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:597:in `new_constants_in'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#mygemset/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in `require'
/Users/myuser/Developer/my-project/vendor/private_gems/restful_authentication-1.4.9/lib/restful_sso_authentication.rb:2
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#global/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `require'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#global/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `require'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#global/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `each'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#global/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `require'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#global/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `each'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#global/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `require'
/Users/myuser/.rvm/gems/ree-1.8.7-2009.10#global/gems/bundler-1.5.2/lib/bundler.rb:131:in `require'
/Users/myuser/Developer/my-project/config/application.rb:5
/Users/myuser/Developer/my-project/Rakefile:6:in `require'
/Users/myuser/Developer/my-project/Rakefile:6
(See full trace by running task with --trace)
I have tried numerous approaches that can be found on Internet (the most relevant examples concerned problems with installing Nokogiri and similar errors where listed) and none of them worked.

Here is my way to install Rubies on variety of Mac OSes for long long time. For me, there were any no problems with any library or gem. For example more complex Nokogiri gem builds and works like a charm.
Check XCode version
xcodebuild -version
xcode-select --install
Install Homebrew as per it's documentation
Install prerequisites
brew doctor; # Just do what it wants!
brew update;
brew upgrade; # Watch out! for existing bottles
brew install libtool libxml2 libxslt openssl sqlite libyaml;
brew install autoconf automake apple-gcc42;
brew cleanup; # Watch out! for existing bottles
brew tap homebrew/dupes; # Watch out! for existing bottles
Install RVM
curl -L https://get.rvm.io | bash -s stable # Latest stable
rvm get latest
rvm reload # :)
rvm autolibs enable
rvm requirements
Install Ruby
rvm install 2.1 --disable-binary

Probably a previous version break the native loading or your libxml2 is too recent and don't fit the gem implementation.
first uninstall all previous gems (gemset, system)
then reinstall the gem
https://gist.github.com/unixcharles/1226596 ?

Related

Error installing ruby-1.9.3-p547 with RVM on osx 10.9.3

How can I get around this error:
$ rvm install 1.9.3
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.9/x86_64/ruby-1.9.3-p547.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Warning: DYLD_LIBRARY_PATH environment variable is set, this might interact with the compilation and ruby.
Installing Ruby from source to: /Users/TomCaflisch/.rvm/rubies/ruby-1.9.3-p547, this may take a while depending on your cpu(s)...
ruby-1.9.3-p547 - #downloading ruby-1.9.3-p547, this may take a while depending on your connection...
ruby-1.9.3-p547 - #extracting ruby-1.9.3-p547 to /Users/TomCaflisch/.rvm/src/ruby-1.9.3-p547...
ruby-1.9.3-p547 - #applying patch /Users/TomCaflisch/.rvm/patches/ruby/GH-488.patch.
ruby-1.9.3-p547 - #configuring.
Error running './configure --prefix=/Users/TomCaflisch/.rvm/rubies/ruby-1.9.3-p547 --with-opt-dir=/usr/local/Cellar/libyaml/0.1.4:/usr/local/Cellar/readline/6.2.4:/usr/local/Cellar/libksba/1.3.0:/usr/local/Cellar/openssl/1.0.1e --without-tcl --without-tk --disable-install-doc --enable-shared',
showing last 15 lines of /Users/TomCaflisch/.rvm/log/1404187306_ruby-1.9.3-p547/configure.log
[2014-06-30 23:01:50] ./configure
current path: /Users/TomCaflisch/.rvm/src/ruby-1.9.3-p547
GEM_HOME=/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327
PATH=/Users/TomCaflisch/.rvm/usr/bin:/usr/local/Cellar/pkg-config/0.28/bin:/usr/local/Cellar/libtool/2.4.2/bin:/usr/local/Cellar/automake/1.14/bin:/usr/local/Cellar/autoconf/2.69/bin:/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327/bin:/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#global/bin:/Users/TomCaflisch/.rvm/rubies/ruby-1.9.3-p327/bin:/Users/TomCaflisch/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/mysql/bin
GEM_PATH=/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327:/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#global
command(7): ./configure --prefix=/Users/TomCaflisch/.rvm/rubies/ruby-1.9.3-p547 --with-opt-dir=/usr/local/Cellar/libyaml/0.1.4:/usr/local/Cellar/readline/6.2.4:/usr/local/Cellar/libksba/1.3.0:/usr/local/Cellar/openssl/1.0.1e --without-tcl --without-tk --disable-install-doc --enable-shared
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... x86_64-apple-darwin13.2.0
checking host system type... x86_64-apple-darwin13.2.0
checking target system type... x86_64-apple-darwin13.2.0
checking whether the C compiler works... no
configure: error: in `/Users/TomCaflisch/.rvm/src/ruby-1.9.3-p547':
configure: error: C compiler cannot create executables
See `config.log' for more details
There has been an error while running configure. Halting the installation.
I'm rocking osx 10.9.4 at the moment.
When i do $ rvm get latest, I get this error:
$ rvm get latest
Downloading https://get.rvm.io
Downloading https://github.com/wayneeseguin/rvm/archive/1.25.28.tar.gz
Upgrading the RVM installation in /Users/TomCaflisch/.rvm/
RVM PATH line found in /Users/TomCaflisch/.bashrc /Users/TomCaflisch/.zshrc.
RVM sourcing line found in /Users/TomCaflisch/.bash_profile /Users/TomCaflisch/.zprofile.
Installing gem-wrappers gem in 4 gemsetsError running 'gem install gem-wrappers -v >=1.2.4 --no-ri --no-rdoc',
showing last 15 lines of /Users/TomCaflisch/.rvm/log/1405391557_ruby-1.9.3-p484/gem.install.gem-wrappers->=1.2.4.log
PATH=/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p484#global/bin:/Users/TomCaflisch/.rvm/rubies/ruby-1.9.3-p484/bin:/Users/TomCaflisch/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/mysql/bin
GEM_PATH=/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p484#global
command(7): gem install gem-wrappers -v >=1.2.4 --no-ri --no-rdoc
Error loading RubyGems plugin "/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p484#global/gems/executable-hooks-1.2.6/lib/rubygems_plugin.rb": dlopen(/Users/TomCaflisch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/x86_64-darwin12.5.0/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /Users/TomCaflisch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/x86_64-darwin12.5.0/openssl.bundle
Reason: image not found - /Users/TomCaflisch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/x86_64-darwin12.5.0/openssl.bundle (LoadError)
/Users/TomCaflisch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/yaml.rb:84:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
ERROR: Loading command: install (LoadError)
dlopen(/Users/TomCaflisch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/x86_64-darwin12.5.0/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /Users/TomCaflisch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/x86_64-darwin12.5.0/openssl.bundle
Reason: image not found - /Users/TomCaflisch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/x86_64-darwin12.5.0/openssl.bundle
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
Error running 'gem install gem-wrappers -v >=1.2.4 --no-ri --no-rdoc',
showing last 15 lines of /Users/TomCaflisch/.rvm/log/1405391559_ruby-2.0.0-p247/gem.install.gem-wrappers->=1.2.4.log
Reason: image not found - /Users/TomCaflisch/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.4.0/psych.bundle
from /Users/TomCaflisch/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:1:in `<top (required)>'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/yaml.rb:5:in `<top (required)>'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems.rb:659:in `load_yaml'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/config_file.rb:327:in `load_file'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/config_file.rb:196:in `initialize'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:74:in `new'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:74:in `do_configuration'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:39:in `run'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.0.0-p247/bin/gem:21:in `<main>'
Error running 'gem install gem-wrappers -v >=1.2.4 --no-ri --no-rdoc',
showing last 15 lines of /Users/TomCaflisch/.rvm/log/1405391560_ruby-2.1.0-preview1/gem.install.gem-wrappers->=1.2.4.log
Reason: image not found - /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview1/lib/ruby/2.1.0/x86_64-darwin12.5.0/psych.bundle
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:53:in `require'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview1/lib/ruby/2.1.0/psych.rb:1:in `<top (required)>'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:53:in `require'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:53:in `require'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview1/lib/ruby/2.1.0/yaml.rb:5:in `<top (required)>'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:53:in `require'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:53:in `require'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview1/lib/ruby/2.1.0/rubygems.rb:659:in `load_yaml'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview1/lib/ruby/2.1.0/rubygems/config_file.rb:326:in `load_file'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview1/lib/ruby/2.1.0/rubygems/config_file.rb:195:in `initialize'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview1/lib/ruby/2.1.0/rubygems/gem_runner.rb:74:in `new'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview1/lib/ruby/2.1.0/rubygems/gem_runner.rb:74:in `do_configuration'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview1/lib/ruby/2.1.0/rubygems/gem_runner.rb:39:in `run'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview1/bin/gem:21:in `<main>'
Error running 'gem install gem-wrappers -v >=1.2.4 --no-ri --no-rdoc',
showing last 15 lines of /Users/TomCaflisch/.rvm/log/1405391560_ruby-2.1.0-preview2/gem.install.gem-wrappers->=1.2.4.log
Reason: image not found - /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview2/lib/ruby/2.1.0/x86_64-darwin12.0/psych.bundle
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview2/lib/ruby/2.1.0/psych.rb:1:in `<top (required)>'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview2/lib/ruby/2.1.0/yaml.rb:5:in `<top (required)>'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview2/lib/ruby/site_ruby/2.1.0/rubygems.rb:659:in `load_yaml'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview2/lib/ruby/site_ruby/2.1.0/rubygems/config_file.rb:327:in `load_file'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview2/lib/ruby/site_ruby/2.1.0/rubygems/config_file.rb:196:in `initialize'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview2/lib/ruby/site_ruby/2.1.0/rubygems/gem_runner.rb:74:in `new'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview2/lib/ruby/site_ruby/2.1.0/rubygems/gem_runner.rb:74:in `do_configuration'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview2/lib/ruby/site_ruby/2.1.0/rubygems/gem_runner.rb:39:in `run'
from /Users/TomCaflisch/.rvm/rubies/ruby-2.1.0-preview2/bin/gem:21:in `<main>'
.
Upgrade of RVM in /Users/TomCaflisch/.rvm/ is complete.
# Tom Caflisch,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.
In case of problems: http://rvm.io/help and https://twitter.com/rvm_io
Upgrade Notes:
* No new notes to display.
RVM reloaded!
Was running in to the same issue. Just ran these commands sorted everything out...
$ xcode-select --install - this seems to be the key.
$ rvm cleanup all - may need to run sudo on this one.
$ rvm get latest
$ rvm install ruby-1.9.3- with whatever patch.
Hope this works for you!
Looks like you're missing the Xcode command line tools.
Try running
xcode-select --install
then run
gcc --version
to see if GCC or LLVM is installed. If it is, you can try installing ruby through RVM again.
I had the same issue. For me this solved the problem:
Launch Xcode. When it launched for me it asked permission to finish downloading and installing a few things (sorry I don't recall the exact message or if it even listed the items). I agreed and waited for it to finish download/installation.
I tried rvm install 1.9.3 again and it worked. rvm get latest also now works without issue.

rails new <app> or rails -h craps out with cannot load such file -- io/console

[ec2-user#ip-XX-XXX-XXX-XXX rails]$ rails -h
/usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- io/console (LoadError)
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/gems/2.0/gems/thor-0.19.1/lib/thor/shell/basic.rb:2:in `<top (required)>'
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/gems/2.0/gems/thor-0.19.1/lib/thor/shell/color.rb:1:in `<top (required)>'
from /usr/local/share/ruby/gems/2.0/gems/thor-0.19.1/lib/thor/shell.rb:17:in `shell'
from /usr/local/share/ruby/gems/2.0/gems/thor-0.19.1/lib/thor/base.rb:439:in `start'
from /usr/local/share/ruby/gems/2.0/gems/railties-4.1.0/lib/rails/commands/application.rb:17:in `<top (required)>'
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/gems/2.0/gems/railties-4.1.0/lib/rails/cli.rb:14:in `<top (required)>'
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/gems/2.0/gems/railties-4.1.0/bin/rails:9:in `<top (required)>'
from /usr/local/bin/rails:23:in `load'
from /usr/local/bin/rails:23:in `<main>'
I did install Ruby on Rails using $ gem install rails and it completed fine as well. I had checked the process status with $echo $? and it was 0 meaning successful.
Interestingly these two commands work fine:
$ which rails
/usr/local/bin/rails
$ rails -v
Rails 4.1.0
This is a Amazon Web Services AMI image 64 bit. Please help me figure this out.
I have the bundler installed:
$ gem install bundler
Fetching: bundler-1.6.2.gem (100%)
Successfully installed bundler-1.6.2
Parsing documentation for bundler-1.6.2
Installing ri documentation for bundler-1.6.2
Done installing documentation for bundler after 5 seconds
1 gem installed
I checked for duplicate installs:
$ find / 2>/dev/null| grep bin/ruby
/usr/bin/ruby
/usr/bin/ruby2.0
$ find / 2>/dev/null| grep bin/rails
/usr/local/share/ruby/gems/2.0/gems/railties-4.1.0/bin/rails
/usr/local/share/ruby/gems/2.0/gems/railties-4.1.0/lib/rails/generators/rails/plugin/templates/bin/rails.tt
/usr/local/share/ruby/gems/2.0/gems/railties-4.1.0/lib/rails/generators/rails/app/templates/bin/rails
/usr/local/share/ruby/gems/2.0/gems/rails-4.1.0/guides/code/getting_started/bin/rails
/usr/local/bin/rails
/home/ec2-user/.gem/ruby/2.0/gems/rails-4.1.0/guides/code/getting_started/bin/rails
You would need to install io-console gem. Install it using following command:
gem install io-console
After this run rails -h
Also, run echo $PATH and make sure that you have /usr/local/bin in the path. If not, then you would need to add it.
So I had resolved this the same night, but somehow Stackoverflow didnt send me any notifications on the responses to the question, so I didnt know of these responses. This is what I ended up doing. It was essentially removing the ruby on rails installation and installing it from scratch. This was on a Amazon Web services server - linux flavor.
sudo yum update
$wget https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer
$ bash -s stable < rvm-installer
$ source /home/ec2-user/.rvm/scripts/rvm
$ rvm requirements
$ sudo yum erase ruby
$ rvm install ruby
$ rvm use ruby --default
$ rvm rubygems current
$ gem install rails # this takes forever
After that it worked just fine.
I had exactly the same issue on AWS Elastic Beanstalk (Puma, Ruby 2, Rails 4.0):
> rails generate simple_form:install --bootstrap
/usr/local/share/ruby/gems/2.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require': cannot load such file -- io/console (LoadError)
I simply added:
gem 'io-console'
To the top of my Gemfile and ran bundle install again on the box for great success. Hopefully quicker than reinstalling rails for anyone else who runs in to this.
Thanks; you need io-console indeed. To make that work, install GCC. Rest is needed later on so:
yum -y install gcc mysql-devel ImageMagick-devel
Then,
gem install io-console
works and I could continue installing.

Ruby 2.1.1 with RVM: Getting libyaml errors

I would like to use Ruby 2.1.1p76 and Rails 4.1.0beta1. I am getting some errors with RVM. I was using Ruby 2.0.0 and Rails 4.0.0. I upgraded to OS X Mavericks 10.9.2 and needed to reload everything.
Anyway, these are the commands I am running.
\curl -sSL https://get.rvm.io | bash -s stable --ruby
This installs successfully. Then I run this command to install rails.
sudo gem install rails
I get the following errors, says it is looking for libyaml.
/Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/yaml.rb:4:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/psych.bundle, 9): Library not loaded: /usr/local/lib/libyaml-0.2.dylib (LoadError)
Referenced from: /Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/psych.bundle
Reason: image not found - /Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/psych.bundle
from /Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/psych.rb:1:in `<top (required)>'
from /Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/yaml.rb:5:in `<top (required)>'
from /Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems.rb:616:in `load_yaml'
from /Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/config_file.rb:328:in `load_file'
from /Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/config_file.rb:197:in `initialize'
from /Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/gem_runner.rb:74:in `new'
from /Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/gem_runner.rb:74:in `do_configuration'
from /Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/gem_runner.rb:39:in `run'
from /Users/username/.rvm/rubies/ruby-2.1.1/bin/gem:21:in `<main>'
So, I run this command which is deprecated.
rvm pkg install libyaml
This gives me a deprecation warning and says to check out autolibs.
So I correct and verify both.
brew install libyaml
##
Warning: libyaml-0.1.4 already installed
more...
brew info libyaml
##
libyaml: stable 0.1.5 (bottled)
http://pyyaml.org/wiki/LibYAML
/usr/local/Cellar/libyaml/0.1.4 (7 files, 344K) *
Built from source
From: https://github.com/mxcl/homebrew/commits/master/Library/Formula/libyaml.rb
==> Options
--universal
Install autolibs.
rvm get stable --autolibs=enable
rvm install ruby
rvm --default use ruby-2.1.1
Then, I get the same error.
Using /Users/username/.rvm/gems/ruby-2.1.1
/Users/username/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/yaml.rb:4:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
brew unlink libyaml && brew link libyaml
https://github.com/wayneeseguin/rvm/issues/2689

Ruby sqlite3 gem not found

I recently downloaded Crunchbang and am downloading a Ruby program. I installed Ruby:
apt-get install ruby
apt-get install rubygems
apt-get install sqlite3
When I run the file, I get:
root#crunchbang:/Pentest/NTLMRelay/ZackAttack# ruby zackattack.rb
/usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find sqlite3 (= 1.3.6) amongst [] (Gem::LoadError)
from /usr/lib/ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /usr/lib/ruby/1.9.1/rubygems.rb:1231:in `gem'
from /Pentest/NTLMRelay/ZackAttack/lib/zfdb.rb:7:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /Pentest/NTLMRelay/ZackAttack/clients/ews.rb:9:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /Pentest/NTLMRelay/ZackAttack/lib/zfclient.rb:6:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /Pentest/NTLMRelay/ZackAttack/lib/zfhttpd.rb:7:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from zackattack.rb:8:in `<main>'
I am completely at a loss. Help is appreciated/
You need to install ruby gem as well:
gem install sqlite3
If your program has a Gemfile, do:
gem install bundler
bundle install
Another advise, install ruby via RVM, it will save you from a number of headaches.
UPDATE:
Most likely you will also need the following package:
sudo apt-get install libsqlite3-ruby
You can also install the gem as follows using apt:
apt-get install ruby-sqlite3
or in my case:
apt-get install sqlite3-ruby
I would avoid installing Ruby using apt-get because you'll face a lot of problems (versions, gem management, etc) down the road. Use RVM instead.
Remove your apt-get installations (especially if your ruby -v returns something before 1.9) and then follow the instructions at http://rvm.io/rvm/install
RVM will allow you to install multiple Ruby versions and manage your gems more easily.
Once you're done with the rvm installation, do the following:
gem install sqlite3 -v 1.3.6
Once you have RVM running, things should become easier... Don't worry about the extra time you're spending in the beginning, it'll pay off :-)

Getting nokogiri to use a newer version of libxml2

I've been trying to get Nokogiri installed on my computer (Mountain Lion) to use with rspec and capybara, but for the life of me, I can't get it to run properly.
From what I can tell, the issue is with nokogiri using the wrong version of libxml2. I've so far tried uninstalling and reinstalling libxml2 using Homebrew (making sure it's the most recent one), uninstalling and reinstalling nokogiri using bundle, and specifying the exact path to the libxml2 files that Homebrew installed when installing the nokogiri gem. My most recent install instructions looked like this
sudo gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.9.0/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.0/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28
where all of those locations do correctly correspond to the locations where the tools are installed. However, upon running bundle exec rspec spec/requests/static_pages.rb, I still get this output:
/Users/alex/.rvm/gems/ruby-1.9.3-p286/gems/nokogiri-1.5.9/lib/nokogiri.rb:28:in `require': dlopen(/Users/alex/.rvm/gems/ruby-1.9.3-p286/gems/nokogiri-1.5.9/lib/nokogiri/nokogiri.bundle, 9): Library not loaded: /usr/local/lib/libxml2.2.dylib (LoadError)
Referenced from: /Users/alex/.rvm/gems/ruby-1.9.3-p286/gems/nokogiri-1.5.9/lib/nokogiri/nokogiri.bundle
Reason: Incompatible library version: nokogiri.bundle requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0 - /Users/alex/.rvm/gems/ruby-1.9.3-p286/gems/nokogiri-1.5.9/lib/nokogiri/nokogiri.bundle
from /Users/alex/.rvm/gems/ruby-1.9.3-p286/gems/nokogiri-1.5.9/lib/nokogiri.rb:28:in `<top (required)>'
from /Users/alex/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `require'
from /Users/alex/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /Users/alex/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `each'
from /Users/alex/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `block in require'
from /Users/alex/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `each'
from /Users/alex/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `require'
from /Users/alex/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.3.4/lib/bundler.rb:132:in `require'
from /Users/alex/Sites/harbingernews/config/application.rb:7:in `<top (required)>'
from /Users/alex/Sites/harbingernews/config/environment.rb:2:in `require'
from /Users/alex/Sites/harbingernews/config/environment.rb:2:in `<top (required)>'
from /Users/alex/Sites/harbingernews/spec/spec_helper.rb:3:in `require'
from /Users/alex/Sites/harbingernews/spec/spec_helper.rb:3:in `<top (required)>'
from /Users/alex/Sites/harbingernews/spec/requests/static_pages_spec.rb:1:in `require'
from /Users/alex/Sites/harbingernews/spec/requests/static_pages_spec.rb:1:in `<top (required)>'
from /Users/alex/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `load'
from /Users/alex/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `block in load_spec_files'
from /Users/alex/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `map'
from /Users/alex/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `load_spec_files'
from /Users/alex/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:22:in `run'
from /Users/alex/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:69:in `run'
from /Users/alex/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:10:in `block in autorun'
I've tried all the steps that I've found online (most reference building and loading different versions of libxml2, like this one, but have had no success yet. My Gemfile and Gemfile.lock can be found here. If anyone can help me out at all, I would really appreciate it. I haven't been able to find any other cases online with this problem.
In Mavericks, installing the libraries with brew and setting NOKOGIRI_USE_SYSTEM_LIBRARIES=1 before installing the gem did the trick for me.
Summarising:
If previously installed, uninstall the gem:
$ gem uninstall nokogiri
Use Homebrew to install libxml2, libxslt and libiconv:
$ brew install libxml2 libxslt libiconv
Install the gem specifying the paths to the libraries to be linked against:
$ NOKOGIRI_USE_SYSTEM_LIBRARIES=1 gem install nokogiri -- --use-system-libraries --with-iconv-dir="$(brew --prefix libiconv)" --with-xml2-config="$(brew --prefix libxml2)/bin/xml2-config" --with-xslt-config="$(brew --prefix libxslt)/bin/xslt-config"
This helps me to update libxml and install nokogiri correctly...
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
brew install libxml2 --with-xml2-config
brew link --force libxml2
brew install libxslt
brew link --force libxslt
bundle config build.nokogiri -- --with-xml2-dir=/usr
--with-xslt-dir=/opt/local --with-iconv-dir=/opt/local
bundle install
Here is the source: http://www.kormoc.com/2013/12/22/nokogiri-libxml2/
Hope this helps somebody...
Just to make it clear, Phrogz's comment helped me out quite a bit. I followed the instructions that he linked to, the What to do if libxml2 is being a jerk? page on Nokogiri's Github page. I ended up using Macports instead of Homebrew, and I'm not sure if that's what made the difference (I had tried many of those steps already) but one way or another, it seems to be working alright now.
Googled this question after upgrading OsX when I had problem:
require': dlopen(/Users/tomi/.rvm/gems/ruby-2.1.1#my-gemset/extensions/x86_64-darwin-12/2.1.0-static/nokogiri-1.5.10/nokogiri/nokogiri.bundle, 9): Library not loaded: /usr/local/opt/libxml2/lib/libxml2.2.dylib (LoadError)
and this worked for me
brew uninstall libxml2 libxslt libiconv
brew install libxml2 libxslt libiconv

Resources