Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can run pear/phpunit from "cmd" just fine. I checked %PATH% and everything that is there is also in $PATH.

To be clear, this is not msysgit -- It is this:

Anyone know how I can make it get recognized?


share|improve this question
How are you invoking it and what is the actual error message you're receiving? – Oliver Salzburg Jul 5 '13 at 15:20
typing in "pear" and "phpunit" from Git Bash -- like I do in "cmd". It was working on a Windows XP computer (which I don't have access to at the moment). Error: sh.exe": pear: command not found – Kerry Jones Jul 5 '13 at 15:30
@Kerry, just to clarify, the versions of git found here and here are the same build. There's no difference. What you linked is the same as Msysgit. – DanteTheEgregore Oct 18 '13 at 20:46
up vote 1 down vote accepted

I found that the problem was not in fact with the PATH (which was matching my Windows path perfectly). The problem is that Git Bash does not run ".bat" files:

To run a batch file you have to do a work around:

cmd "/c /path/to/batch.bat"


The solution in my case was to make an alias for phpunit in my .bash_profile file:

alias phpunit='cmd "/c phpunit.bat"'

Hope that helps anyone else with the same problem.


I discovered that if you want to use arguments (such as specific a specific file to test) you will need to change what you put in your .bash_profile to the following:

function __phpunit {                                                                
    cmd "/c phpunit.bat $@"  

alias phpunit=__phpunit
share|improve this answer

Remove the .phar extension and disregard making the bat file if you're using an editor that isn't command prompt.

In the last line on the Windows installation documentation for phpunit it reads:

For Cygwin and/or MingW32 (e.g., TortoiseGit) shell environments, you may skip step 5. above, simply save the file as phpunit (without .phar extension), and make it executable via chmod 775 phpunit.


The Git Bash install that you linked is using MINGW32. That is what you have.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.