Roman Zabicki Roman Zabicki - 5 months ago 20
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
. 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

ruby-1.9.2-p136@pax-arachnae:

system:
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)"

rvm:
version: "rvm 1.0.9 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]"

ruby:
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]"

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

binaries:
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"

environment:
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/Emacs.app/Contents/MacOS:/Applications/MacVim.app/Contents/MacOS:/usr/local/mysql/bin:/Developer/usr/bin:/Users/rfzabick/.ec2/ec2-api-tools-1.3-62308/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/Applications/Google Chrome.app/Contents/MacOS"
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"
RUBYOPT: ""
gemset: "pax-arachnae"

Answer

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.

Comments