For several days I have been struggling with a Rails app. I tried everything I could, asked some questions on SO and tried to gather all the information and tricks I could. Here's the summary:
Some days ago, when I ran rails s
, I got the following, knowing I removed ruby-2.0.0-p0:
`require': dlopen(/Users/git/gitlab/vendor/bundle/ruby/2.0.0/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle, 9): Library not loaded: /home/.rvm/rubies/ruby-2.0.0-p0/lib/libruby.2.0.0.dylib (LoadError)
Referenced from: /Users/git/gitlab/vendor/bundle/ruby/2.0.0/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle
Reason: image not found - /Users/git/gitlab/vendor/bundle/ruby/2.0.0/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle
I was told on SO this could be related to RVM. I switched from RVM to rbenv, and I uninstalled/reinstalled Ruby (not the built-in OS X one) and Rails and got the same message when running rails s
.
Then I uninstalled and deleted completely Macports and tried again with rbenv and got the same message.
I tried to symlink /home/.rvm/rubies/ruby-2.0.0-p0/lib/libruby.2.0.0.dylib
to /usr/local
, I got the same message.
I tried playing around with exporting DYLD_LIBRARY_PATH
but I got the same message.
I uninstalled rbenv, Rails, and I returned to Macports and RVM, and I still get the same message.
Could some one help please?
I am using OS X.
ruby -v outputs
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.4.0]
rails -v outputs
Rails 3.2.13
I deleted ruby-2.0.0-p0.
Edit:
grep rvm ~/.bashrc
outputs:
PATH=$HOME/.rvm/bin:$PATH # Add RVM to PATH for scripting
grep rvm ~/.bash_profile
outputs:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
echo $PATH
outputs:
/home/.rvm/gems/ruby-2.0.0-p195/bin:/home/.rvm/gems/ruby-2.0.0-p195@global/bin:/home/.rvm/rubies/ruby-2.0.0-p195/bin:/home/.rvm/bin:/opt/local/bin:/opt/local/sbin:/Applications/MAMP/bin/php/php5.4.4/bin:/usr/local/ActivePerl-5.16/site/bin:/usr/local/ActivePerl-5.16/bin:/usr/local/mysql/bin:/sw/bin:/sw/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/ant/bin:/usr/local/mongodb/bin:/home/bin:/Users/otherhome/Desktop/Sites/apache-ant/bin:/usr/local/bro/bin:/opt/bro/bin
gem env
outputs:
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 2.0.0 (2013-05-14 patchlevel 195) [x86_64-darwin12.4.0]
- INSTALLATION DIRECTORY: /home/.rvm/gems/ruby-2.0.0-p195
- RUBY EXECUTABLE: /home/.rvm/rubies/ruby-2.0.0-p195/bin/ruby
- EXECUTABLE DIRECTORY: /home/.rvm/gems/ruby-2.0.0-p195/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-12
- GEM PATHS:
- /home/.rvm/gems/ruby-2.0.0-p195
- /home/.rvm/gems/ruby-2.0.0-p195@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
rvm info
outputs:
system:
uname: "Darwin MacBook-Pro-de-moi.local 12.4.0 Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64"
system: "osx/10.8/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin12.0)"
rvm:
version: "rvm 1.21.7 () by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "13 hours 8 minutes 18 seconds ago"
ruby:
interpreter: "ruby"
version: "2.0.0p195"
date: "2013-05-14"
platform: "x86_64-darwin12.4.0"
patchlevel: "2013-05-14 revision 40734"
full_version: "ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.4.0]"
homes:
gem: "/home/.rvm/gems/ruby-2.0.0-p195"
ruby: "/home/.rvm/rubies/ruby-2.0.0-p195"
binaries:
ruby: "/home/.rvm/rubies/ruby-2.0.0-p195/bin/ruby"
irb: "/home/.rvm/rubies/ruby-2.0.0-p195/bin/irb"
gem: "/home/.rvm/rubies/ruby-2.0.0-p195/bin/gem"
rake: "/home/.rvm/gems/ruby-2.0.0-p195@global/bin/rake"
environment:
PATH: "/home/.rvm/gems/ruby-2.0.0-p195/bin:/home/.rvm/gems/ruby-2.0.0-p195@global/bin:/home/.rvm/rubies/ruby-2.0.0-p195/bin:/home/.rvm/bin:/opt/local/bin:/opt/local/sbin:/Applications/MAMP/bin/php/php5.4.4/bin:/usr/local/ActivePerl-5.16/site/bin:/usr/local/ActivePerl-5.16/bin:/usr/local/mysql/bin:/sw/bin:/sw/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/ant/bin:/usr/local/mongodb/bin:/home/bin:/Users/otherhome/Desktop/Sites/apache-ant/bin:/usr/local/bro/bin:/opt/bro/bin"
GEM_HOME: "/home/.rvm/gems/ruby-2.0.0-p195"
GEM_PATH: "/home/.rvm/gems/ruby-2.0.0-p195:/home/.rvm/gems/ruby-2.0.0-p195@global"
MY_RUBY_HOME: "/home/.rvm/rubies/ruby-2.0.0-p195"
IRBRC: "/home/.rvm/rubies/ruby-2.0.0-p195/.irbrc"
RUBYOPT: ""
gemset: ""
which ruby
outputs:
/home/.rvm/rubies/ruby-2.0.0-p195/bin/ruby
you rails thinks it should use --deployment
/ or --path
from bundler - it's the path to gems: /Users/git/gitlab/vendor/bundle/ruby/2.0.0/gems
, unfortunately bundler is nto smart enough and does not handle properly changes in ruby, you need to remove whole directory rm -rf /Users/git/gitlab/vendor/bundle
and bundle install
again.
I would recommend you stop using --deployment
/ or --path
flags from bundler, remove the directories rm -rf /Users/git/gitlab/vendor/bundle
, rm -rf /Users/git/gitlab/.bundle/
and install gems in gemset, this way this problem will not happen again.
In case of capistrano deployments set this flags for bundler/capistrano
:
set :bundle_dir, ''
set :bundle_flags, '--system --quiet'
to prevent using --deployment
and --path
flags with bundler.