Roman Zabicki Roman Zabicki - 1 year ago 73
Ruby Question

fork: Resource temporarily unavailable when calling rvm from a shell script, but rvm works fine by itself

I want to switch between different projects, and one part of that is changing rubies and gemsets via

. RVM works great for me by itself, but when I put a call to it into a shell script, I get:

fork: Resource temporarily unavailable

Here's the output from rvm info. Let me know if there's any other info I can give that would be useful.

$ rvm info


uname: "Darwin savoy.local 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)"
zsh: "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)"

version: "rvm 1.0.9 by Wayne E. Seguin ( []"

interpreter: "ruby"
version: "1.9.2p136"
date: "2010-12-25"
platform: "x86_64-darwin10.6.0"
patchlevel: "2010-12-25 revision 30365"
full_version: "ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0]"

gem: "/Users/rfzabick/.rvm/gems/ruby-1.9.2-p136@pax-arachnae"
ruby: "/Users/rfzabick/.rvm/rubies/ruby-1.9.2-p136"

ruby: "/Users/rfzabick/.rvm/rubies/ruby-1.9.2-p136/bin/ruby"
irb: "/Users/rfzabick/.rvm/rubies/ruby-1.9.2-p136/bin/irb"
gem: "/Users/rfzabick/.rvm/rubies/ruby-1.9.2-p136/bin/gem"
rake: "/Users/rfzabick/.rvm/gems/ruby-1.9.2-p136@pax-arachnae/bin/rake"

PATH: "/Users/rfzabick/.rvm/gems/ruby-1.9.2-p136@pax-arachnae/bin:/Users/rfzabick/.rvm/gems/ruby-1.9.2-p136@global/bin:/Users/rfzabick/.rvm/rubies/ruby-1.9.2-p136/bin:/Users/rfzabick/.rvm/bin:/usr/local/bin:/Applications/"
GEM_HOME: "/Users/rfzabick/.rvm/gems/ruby-1.9.2-p136@pax-arachnae"
GEM_PATH: "/Users/rfzabick/.rvm/gems/ruby-1.9.2-p136@pax-arachnae:/Users/rfzabick/.rvm/gems/ruby-1.9.2-p136@global"
BUNDLE_PATH: "/Users/rfzabick/.rvm/gems/ruby-1.9.2-p136@pax-arachnae"
MY_RUBY_HOME: "/Users/rfzabick/.rvm/rubies/ruby-1.9.2-p136"
IRBRC: "/Users/rfzabick/.rvm/rubies/ruby-1.9.2-p136/.irbrc"
gemset: "pax-arachnae"

Answer Source

I use RVM in shell scripts and it works fine. One thing that might explain why you're unable to, is your version is old. The current version is 1.2.8, and you're on 1.0.9.

RVM updates often, so it's a good idea to update it every couple weeks at least. In the current RVM we'd use rvm get head to update, but I'm not sure it that was the same in 1.0.9. If not try rvm help update.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download