Skip to content


Failure in posix-spawn #32

kikito opened this Issue · 41 comments

Note: if you experience this issue, or even if you don't, please add a row to this Google spreadsheet to help track this bug down.

git-up fails when I try to execute it from ruby 1.9.3-p194:

git:(master)$ git up
/Users/user/.rvm/gems/ruby-1.9.3-p194/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:187:in `_pspawn': Invalid command name (ArgumentError)
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:187:in `pspawn'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:160:in `spawn'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:307:in `popen4'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/posix-spawn-0.3.6/lib/posix/spawn/child.rb:105:in `exec!'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/posix-spawn-0.3.6/lib/posix/spawn/child.rb:80:in `initialize'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/git.rb:345:in `new'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/git.rb:345:in `native'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/git.rb:372:in `method_missing'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/config.rb:40:in `config_lines'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/config.rb:32:in `load_config'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/config.rb:27:in `data'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/grit-2.5.0/lib/grit/config.rb:14:in `[]'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/git-up-0.5.8/lib/git-up.rb:262:in `config'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/git-up-0.5.8/lib/git-up.rb:242:in `prune?'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/git-up-0.5.8/lib/git-up.rb:7:in `run'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/git-up-0.5.8/bin/git-up:5
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/bin/git-up:19:in `load'
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/bin/git-up:19
    from /Users/user/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14

Can't reproduce, but you're not the only one who's got it - #33 sounds similar, seems either posix-spawn or grit is misbehaving. Let me know if you find anything.


It works when I remote to my Ubuntu server running ruby 1.8.7. I'm running ruby 1.9.2p180 at work on a Windows 7 machine and it's not working.


I have the same issue:

/usr/local/rvm/gems/ruby-1.9.3-p194@sr/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:187:in `_pspawn': Invalid command name (ArgumentError)

but it only happens when running git up when I run the separate command git-up it does work as expected

Looks like this might have something to do with the environment changes RVM makes? as the thread owner also seems to use rvm.


@ahmeij I am using rvm, yes. My hardware is a mac with the latest OSX.


I tried running git-up and I got the same error on my work machine (Windows 7)


I had the same problem (OS X, rvm), but don't anymore. Unfortunately I'm not sure exactly what fixed it. When working on other things I installed the latest Command Line Tools for OS X (, and also reinstalled git, and I guess anyone of them could have something to do with it working again.


Which version of grit is everyone running? Check with:

gem list grit --local

I'm on 2.5.0.

I'm getting closer to a resolution and it seems to be with grit, but I'm not positive yet.


I'm also on grit 2.5.0.

It might help to say that I'm using OSX gcc instead of the default mac dev stuff.




My versions (keeping in mind I don't have the bug) are: ruby 1.9.3p194, git-up 0.5.8, grit 2.5.0, posix-spawn 0.3.6.

Not sure which dev tools I'm using, but my gcc seems to be symlinked to llvm-gcc-4.2.


My versions: grit (2.5.0), posix-spawn (0.3.6), git-up (0.5.8), rvm 1.16.8, ruby 1.9.3p194, git version


git-up: works
git up: fails (spawn.rb:187:in `_pspawn': Invalid command name (ArgumentError))

I tried making making this ruby default in rvm and installing git-up in the default gemset, both did not change anything

I'm happy using git-up instead of git up, just trying to help figure out the issue

pspawn 187 is called with these arguments when failing:

Env: {}
Argv: [["/usr/libexec/git-core/git", "/usr/libexec/git-core/git"], "--git-dir=/Users/admin/dev/socialreferral/.git", "config", "--list"] 
Options: {#<IO:0x102acda98>=>:close, :in=>#<IO:0x102acdb88>, :out=>#<IO:0x102acda48>, #<IO:0x102acd980>=>:close, #<IO:0x102acdb10>=>:close, :err=>#<IO:0x102acd930>}

And when succeeding:

Env: {}
Argv: [["/usr/bin/git", "/usr/bin/git"], "--git-dir=/Users/admin/dev/socialreferral/.git", "config", "--list"] 
Options: {:in=>#<IO:fd 5>, #<IO:fd 6>=>:close, :out=>#<IO:fd 8>, #<IO:fd 7>=>:close, :err=>#<IO:fd 10>, #<IO:fd 9>=>:close}

I've created a Google spreadsheet to collect this data; please fill yours in and colour your row appropriately. I've already filled in mine and @ahmeij's as a demonstration.


Same problem as ot-brett-jones trying to use either git-up or git up in Win 7, msysgit, RubyInstaller w/ DevKit. Updated the spreadsheet with my information.


Balls - actually, according to rtomayko/posix-spawn#30, posix-spawn won't work on a Windows environment, and since grit uses it, by definition it won't work on a Windows machine. Ah well.


Well there you have it... @aanand, you can probably close this issue since it's not related directly to git-up.


I wouldn't necessarily say that's the case - it's only proven that posix won't work on Windows. Considering the other people who are reporting are on different infrastructures, I'd say that our problem is unrelated but the issue still stands.


Added my details to spreadsheet


Also seeing bug, details added.


Also have this bug for git-up but not for git up. Have added my details to the spreadsheet.


@Port3M5, you are the first person on the spreadsheet to experience a problem with git-up but not with git up. Are you sure that it works that way round?


@Port3M5, it seems like you meant the other way around like @ahmeij.


No I can confirm that it does in fact work that way round as you can see below

Gandalf:business-report (develop) anthony$ git-up
/Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:187:in `_pspawn': Permission denied - posix_spawnp (Errno::EACCES)
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:187:in `pspawn'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:160:in `spawn'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:307:in `popen4'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/posix-spawn-0.3.6/lib/posix/spawn/child.rb:105:in `exec!'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/posix-spawn-0.3.6/lib/posix/spawn/child.rb:80:in `initialize'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/grit-2.5.0/lib/grit/git.rb:345:in `new'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/grit-2.5.0/lib/grit/git.rb:345:in `native'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/grit-2.5.0/lib/grit/git.rb:372:in `method_missing'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/grit-2.5.0/lib/grit/config.rb:40:in `config_lines'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/grit-2.5.0/lib/grit/config.rb:32:in `load_config'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/grit-2.5.0/lib/grit/config.rb:27:in `data'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/grit-2.5.0/lib/grit/config.rb:14:in `[]'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/git-up-0.5.8/lib/git-up.rb:262:in `config'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/git-up-0.5.8/lib/git-up.rb:242:in `prune?'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/git-up-0.5.8/lib/git-up.rb:7:in `run'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/gems/git-up-0.5.8/bin/git-up:5:in `<top (required)>'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/bin/git-up:19:in `load'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/bin/git-up:19:in `<main>'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/anthony/.rvm/gems/ruby-1.9.3-p327-falcon/bin/ruby_noexec_wrapper:14:in `<main>'
Gandalf:business-report (develop) anthony$ git up
Fetching origin
article_tags up to date
crons        up to date
develop      up to date
live         fast-forwarding...
returning to develop

That's not the same error. You're getting "Permission Denied" when you run "git-up". Try changing the permissions of the git-up script with

chmod +x


I do see what you're saying about it being a different issue, however chmodding has not fixed this issue.

Thanks for the help regardless.


I was getting the posix issue when I was using git version (Apple Git-33). The issue went away after I installed the latest git from homebrew (git version Make sure that /usr/local/bin appears in $PATH before /usr/bin so that you don't use the older git version bundled with Xcode.


Interesting. I just tried it on a machine with an older Apple Git installed and it worked fine, though:

$ git --version
git version (Apple Git-31.1)
$ git up # works
$ git-up # works

Could you add both cases to the spreadsheet, in any case?


Having this issue too on latest MacOS, heroku toolbelt, RVM:

alex-kravets:enltnd akravets$ git up
/Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:187:in `_pspawn': Invalid command name (ArgumentError)
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:187:in `pspawn'
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:160:in `spawn'
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:307:in `popen4'
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/posix-spawn-0.3.6/lib/posix/spawn/child.rb:105:in `exec!'
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/posix-spawn-0.3.6/lib/posix/spawn/child.rb:80:in `initialize'
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/grit-2.5.0/lib/grit/git.rb:345:in `new'
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/grit-2.5.0/lib/grit/git.rb:345:in `native'
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/grit-2.5.0/lib/grit/git.rb:372:in `method_missing'
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/grit-2.5.0/lib/grit/config.rb:40:in `config_lines'
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/grit-2.5.0/lib/grit/config.rb:32:in `load_config'
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/grit-2.5.0/lib/grit/config.rb:27:in `data'
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/grit-2.5.0/lib/grit/config.rb:14:in `[]'
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/git-up-0.5.8/lib/git-up.rb:262:in `config'
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/git-up-0.5.8/lib/git-up.rb:242:in `prune?'
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/git-up-0.5.8/lib/git-up.rb:7:in `run'
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/gems/git-up-0.5.8/bin/git-up:5
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/bin/git-up:19:in `load'
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/bin/git-up:19
    from /Users/akravets/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14
alex-kravets:enltnd akravets$ git-up
Fetching origin
master   up to date
release3 up to date

This has been bugging me a lot recently so I decided to take a deep dive and came up with a workaround.
It's definitely an RVM thing, the problem is with what git [some command] does under the hood.

First git looks internally for the command, then if it can't find it: it will attempt to run git-[your command] so git up makes git try to run an executable in your $PATH called git-up.


I think the problem is that even though the environmental variables are the same (i think they get copied somewhere in run_command_v_opt()), RVM doesn't get to do it's stuff so which ruby still points to /usr/bin/ruby instead of RVM's ruby.

So to fix the problem we somehow need force git-up to use RVM's instance of ruby.
We could manually change the shebang, but that's nasty... so here's my hacky (probably just as nasty) workaround (tested on OSX Mountain Lion):

rvm wrapper [ruby-version@gemset] git git-up
sudo ln -s /Users/me/.rvm/bin/git_git-up /usr/libexec/git-core/git-up

That seems to do the trick for me, it works because git adds /usr/libexec/git-core to start of the $PATH.

Enjoy! :smile_cat:


This presents us with another problem:
The RVM wrapper will attempt to exec git-up which works fine normally, but when you're in another ruby project (using bundler) you may hit this lovely bug:

gems/bundler-1.1.5/lib/bundler/spec_set.rb:90:in `block in materialize': Could not find [some gem] in any of the sources (Bundler::GemNotFound)

I'm pretty sure this is all to do with ruby_noexec_wrapper.

If you take a look at the source it attempts to load rubygems-bundler:

#!/usr/bin/env ruby


require 'rubygems'
  require 'rubygems-bundler/noexec'
rescue LoadError
  warn "unable to load rubygems-bundler/noexec" if ENV.key?('NOEXEC_DEBUG')

eval, binding, original_file

I think the issue here is that somewhere along the line bundler is going to incorrectly hit our projects Gemfile.

So here's another hack on a hack which fixes it for me, edit the RVM wrapper we generated and change this:

if [[ -s "/Users/daniel/.rvm/environments/ruby-1.9.2-p320@global" ]]
  source "/Users/daniel/.rvm/environments/ruby-1.9.2-p320@global"
  exec git-up "$@" # <- CHANGE ME! :)
  echo "ERROR: Missing RVM environment file: '/Users/daniel/.rvm/environments/ruby-1.9.2-p320@global'" >&2
  exit 1

to this:

if [[ -s "/Users/daniel/.rvm/environments/ruby-1.9.2-p320@global" ]]
  source "/Users/daniel/.rvm/environments/ruby-1.9.2-p320@global"
  ruby `which git-up`
  echo "ERROR: Missing RVM environment file: '/Users/daniel/.rvm/environments/ruby-1.9.2-p320@global'" >&2
  exit 1

It's hack for sure, but I'm not sure if there's a clean fix.

Out of interest does anyone have this problem on rbenv?


Excellent work, @boxofrad. Assuming this is the source of everyone's pain, would you care to write up a friendly description of the problem and how to work around it? I'll put it in a separate file in the repo and link to it in the README under a "Warning for RVM users" header or something.

As for rbenv, no-one seems to have reported a problem under it, according to the spreadsheet.


Sure thing :)

@aanand aanand closed this

This still fails for both git-up and git up on windows with no RVM, but using the ruby installer and dev kit (to make it build native extensions):

The same issue affects the gollum wiki server.... I have updated your spreadsheet


@silasdavis posix-spawn doesn't seem to officially support Windows - you could try following the steps in #34.


When I run rvm wrapper [ruby-version@gemset] git git-up in Terminal

I get:

awk: nonterminated character class ^[ruby-version=
 source line number 1
 context is
     >>> /^[ruby-version=/ <<< 
sed: 1: "s#^[ruby-version=##
": unbalanced brackets ([])
Unknown ruby interpreter string component: '[ruby'.
Could not load ruby [ruby-version@gemset].

What am I doing wrong?


@akrabat I'm not an RVM user, but I'm gonna guess [ruby-version] and [gemset-name] should be replaced with the ruby version and gemset name that you've installed git-up under. So the command should look like, for example:

rvm wrapper 1.9.3-p194@mygemset git git-up

I also have the issue. git up gives Invalid command name error. git-up works. I updated the spreadsheet as well.


@wmeyers Have you consulted the RVM guide?


I have done all the things at the RVM guide; it made no difference:

rlpowell@shell01> /usr/libexec/git-core/git-up
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/posix-spawn-0.3.8/lib/posix/spawn.rb:187:in _pspawn': Invalid command name (ArgumentError)
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/posix-spawn-0.3.8/lib/posix/spawn.rb:187:in
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/posix-spawn-0.3.8/lib/posix/spawn.rb:160:in spawn'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/posix-spawn-0.3.8/lib/posix/spawn.rb:312:in

"git up" does the same thing, as does many other things I have tried. No way of calling this program seems to work.

The truly strange part is that if I add:

  print "#{env}, #{argv}, #{options}"

at the line in question in spawn.rb, I get:

  {}, [["/usr/bin/git", "/usr/bin/git"], "--git-dir=/home/rlpowell/src/aws_puppet3/.git", "config", "--list"], {:in=>#<IO:fd 7>, #<IO:fd 8>=>:close, :out=>#<IO:fd 10>, #<IO:fd 9>=>:close, :err=>#<IO:fd 12>, #<IO:fd 

which seems about as inoccuous as a command could possibly get!

No idea what's going on here or what to do about it.


Here's the fun part: the following:

sudo /usr/local/rvm/bin/rvm gemset create git-up
sudo /usr/local/rvm/bin/rvm ruby-2.0.0-p247@git-up do gem install git-up
/usr/local/rvm/wrappers/ruby-2.0.0-p247@git-up/ruby /usr/local/rvm/gems/ruby-2.0.0-p247@git-up/bin/git-up

works with no trouble.

Having done so, the following also works:

sudo rvm wrapper ruby-2.0.0-p247@git-up --no-prefix git-up
git up

So, no idea, but creating the new gemset fixed it, so there's an addition to
the workaround for future use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.