Homebrew: Cask 'java' is unreadable

by Carl Furrow — on  ,  , 

On my personal and work machines, when running brew update today I ran into this issue:



I had no idea what it meant, but it looked like a Ruby error, so I tried to dig into what this was all about.

I did a lot of ag (brew install the_silver_searcher) searching of the /usr/local directory, trying to find what “undent” was all about, and it appears to be some helper method added to the Ruby String class, but it’s only used inside of automated tests for Homebrew, and not available as part of a cask definition. A bug?

For now, the fix was easy: remove .undent from the java.rb cask definition on my machines.

The fix

  1. Find the java.rb cask file on your local machine
    1. find /usr/local/Caskroom -name 'java.rb'
    2. Mine was here: /usr/local/Caskroom/java/.metadata/1.8.0_144-b01,090f390dda5b47b9b721c7dfaa008135/20170827132848.522/Casks/java.rb
  2. Edit that file
  3. Find this line around line 95: caveats <<-EOS.undent and change it to caveats <<-EOS
  4. Save the file
  5. Run brew update or whatever brew command you were trying to run.

Carl Furrow's photo Author

Carl Furrow

hello@carlfurrow.com

Addicted to learning and looking to master the art of solving problems through writing code, while occasionally yelling at computer screens.