Thursday, October 20, 2011

OSX homebrew update: unexpected token near HOMEBREW_BREW_FILE

Update: I have seen this issue with other packages as well. Here is a recipe to make sure a specific version of ruby is used:
cp -p /usr/local/bin/brew /usr/local/bin/brew.old
echo  '#!'/Users/`whoami`/.rvm/rubies/ruby-1.8.7-p160/bin/ruby > /tmp/f1
sed '1d' /usr/local/bin/brew > /tmp/f2
cat /tmp/f1 /tmp/f2 > /usr/local/bin/brew
Original Post: After upgrading homebrew:
$ brew update

I got errors:
$ brew install mozilla-js
/usr/local/bin/brew: line 4: syntax error near unexpected token `('
/usr/local/bin/brew: line 4: `HOMEBREW_BREW_FILE = ENV['HOMEBREW_BREW_FILE'] = File.expand_path(__FILE__)'

Here is a temporary solution which you will need to do everytime you update brew:
$ sudo vi /usr/local/bin/brew

1 comment:

Naive said...

Hi, I had the exact problem after using rbenv's ruby and this fixed it for me. Thanks!