Brew install fails while updating

In one of my build steps in a iOS container I have brew install watchman. It has been working properly for a while, but since yesterday I’ve been getting the following error:

/usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative': /usr/local/Homebrew/Library/Homebrew/global.rb:110: syntax error, unexpected keyword_rescue, expecting keyword_end (SyntaxError)
	from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'
Exited with code 1

I was able to fix it once by ssh’ing into the machine and run brew update-reset before that command of brew install watchman was executed. But this is not really a fix, because if I run again it will throw the same error.

Any tips on how to address this?

Has the latest version of Watchman changed recently? If so, can you pin to the specific version that worked for you before?

Hi @halfer, thanks for the quick response.
I just changed to brew install watchman@4.9.0 but still had the same issue.

Just confirmed that the problem is with brew update. I just changed the command to: HOMEBREW_NO_AUTO_UPDATE=1 brew install watchman and the build was successful.

2 Likes