Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

After these errors:

> brew update
fatal: 'origin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master

> brew doctor
fatal: 'origin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
Error: undefined method `[]' for nil:NilClass
Please report this bug:
/usr/local/Library/Homebrew/cmd/doctor.rb:840:in `check_for_outdated_homebrew'
/usr/local/Library/Homebrew/extend/pathname.rb:310:in `cd'
/usr/local/Library/Homebrew/extend/pathname.rb:310:in `chdir'
/usr/local/Library/Homebrew/extend/pathname.rb:310:in `cd'
/usr/local/Library/Homebrew/cmd/doctor.rb:837:in `check_for_outdated_homebrew'
/usr/local/Library/Homebrew/cmd/doctor.rb:907:in `send'
/usr/local/Library/Homebrew/cmd/doctor.rb:907:in `doctor'
/usr/local/Library/Homebrew/cmd/doctor.rb:906:in `each'
/usr/local/Library/Homebrew/cmd/doctor.rb:906:in `doctor'
/usr/local/bin/brew:83:in `send'

I tried:

> cd 'brew --prefix'
-bash: cd: brew --prefix: No such file or directory

I'm a newbie to brew and I'm trying to use it to fix problems with my MySQL installation. Any ideas what's going on here?

share|improve this question

migrated from stackoverflow.com Jun 12 '12 at 21:11

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 4 down vote accepted

To do your cd command, you need to use backticks, not the quotation mark (putting this in an answer because difficult to format)

cd `brew --prefix`

The backticks make the shell execute the command and return the value. (in this case brew --prefix transforms into the directory where homebrew is installed). For example, in a very simple case:

cd `echo '..'`

Transforms into:

cd ..

Which goes up a directory.

It looks like something is wrong with the git repo for your homebrew install. If you haven't installed a lot, might be easier to just uninstall and reinstall and try again. You should go to the docs for brew, but you can just rm -rf on your Cellar folder and have everything return to its original state. More info here.

share|improve this answer
Thanks Jeff! +1 –  sscirrus Jun 12 '12 at 20:35
And that's why we should all use $() instead. –  slhck Jun 12 '12 at 22:01

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.