I think that $ARGV is missing in the else clause when a Gemfile isn't being used, on this line: $SELFDIR/lib/ruby/bin/ruby "$3"