I am getting Homebrew error while setting up environment for macOS. The environment setup worked just few days ago. Currently I am getting syntax error as below.
/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
’
Link to the job:
https://travis-ci.org/rkollataj/CANdevStudio/jobs/601227463
Is this a TravisCI malfuntion? Does anyone gets similar issue?
The problem was caused by homebrew auto update. Disabling auto update solves the problem:
e.g.
HOMEBREW_NO_AUTO_UPDATE=1 brew install qt5 ninja
2 Likes
Thanks for the solution.
Same applies for brew tap and brew tap-pin:
- HOMEBREW_NO_AUTO_UPDATE=1 brew tap cartr/qt4
- HOMEBREW_NO_AUTO_UPDATE=1 brew tap-pin cartr/qt4
- HOMEBREW_NO_AUTO_UPDATE=1 brew install qt@4
This is a bug in Homebrew that was fixed in https://github.com/Homebrew/brew/commit/00dbb221b7c125073957ca51d2341adc11f6aafc (1.9.0). It happens on Homebrew autoupdate: the post-update invocation still uses the old environment (in this particular situation, the old Ruby version). It surfaced since https://github.com/Homebrew/brew/commit/341ea6080716cb06c83fb8a232f2f5929700c1a0 which added Ruby 2.5+ exclusive syntax.
Travis staff need to update Homebrew in affected images. @BanzaiMan @dominic
A workaround is to either
- disable autoupdate with
HOMEBREW_NO_AUTO_UPDATE=1 <command>
or export HOMEBREW_NO_AUTO_UPDATE=1
as mentioned before, or
- run
brew update
manually before other brew
commands
https://travis-ci.com/GNUSim8085/GNUSim8085/jobs/256697127
I used to get similar error but now I am getting error that ruby version is old (version is 2.3, required is 2.6). Should I also disable auto update?
I can confirm that the HOMEBREW_NO_AUTO_UPDATE=1
solution works for the new 2.3 vs 2.6 variant of the problem.