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>
orexport HOMEBREW_NO_AUTO_UPDATE=1
as mentioned before, or - run
brew update
manually before otherbrew
commands