I started getting the following error when updating my casks recently:
Error: Cask 'java' definition is invalid: Token '{:v1=>"java"}' in header line does not match the file name.
I'm on MacOS 10.14.4, and my Homebrew version:
→ brew --version
Homebrew 2.1.2
Homebrew/homebrew-core (git revision 6811d1; last commit 2019-05-11)
Homebrew/homebrew-cask (git revision ba4e3; last commit 2019-05-11)
Here's the output of brew cask upgrade --verbose --debug
:
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
angular-cli atlassian-cli libpqxx terraforming
app-engine-python elasticsearch osm2pgrouting
asciidoctorj jenkins-lts postgresql
==> Casks with `auto_updates` or `version :latest` will not be upgraded
==> Upgrading 1 outdated package:
Error: Cask 'java' definition is invalid: Token '{:v1=>"java"}' in header line does not match the file name.
/usr/local/Homebrew/Library/Homebrew/cask/cask_loader.rb:73:in `cask'
/usr/local/Caskroom/java/.metadata/1.8.0_51-b16/20150725210402.758/Casks/java.rb:1:in `load'
/usr/local/Homebrew/Library/Homebrew/cask/cask_loader.rb:62:in `instance_eval'
/usr/local/Homebrew/Library/Homebrew/cask/cask_loader.rb:62:in `load'
/usr/local/Homebrew/Library/Homebrew/cask/cask_loader.rb:178:in `load'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/upgrade.rb:39:in `block in run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/upgrade.rb:37:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/upgrade.rb:37:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/abstract_command.rb:36:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:92:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:158:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:123:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:9:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:102:in `<main>'
Error: Kernel.exit
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:162:in `exit'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:162:in `rescue in run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:146:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:123:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:9:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:102:in `<main>'
and the output of brew tap
:
beeftornado/rmtree
heroku/brew
homebrew/cask
homebrew/core
homebrew/services
Here's the output of brew doctor
if it helps:
→ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
/Users/myUser/anaconda3/bin/icu-config
/Users/myUser/anaconda3/bin/krb5-config
/Users/myUser/anaconda3/bin/freetype-config
/Users/myUser/anaconda3/bin/xslt-config
/Users/myUser/anaconda3/bin/libpng16-config
/Users/myUser/anaconda3/bin/python3.6m-config
/Users/myUser/anaconda3/bin/libpng-config
/Users/myUser/anaconda3/bin/xml2-config
/Users/myUser/anaconda3/bin/python3-config
/Users/myUser/anaconda3/bin/curl-config
/Users/myUser/anaconda3/bin/ncursesw6-config
/Users/myUser/anaconda3/bin/pcre-config
/Users/myUser/anaconda3/bin/python3.6-config
/Applications/Postgres.app/Contents/Versions/9.4/bin/gdal-config
Warning: Some installed formulae are not readable:
dotwrp: Unsupported special dependency :fortran
(base)
I've searched but cannot seem to find a way to fix this. Any suggestions?
Solved by doing the following:
vim /usr/local/Caskroom/java/.metadata/1.8.0_51-b16/20150725210402.758/Casks/java.rb
cask :v1 => 'java' do
to
cask 'java' do
Removed the undent
comments at the end of the cask, which were giving me problems.
Ran brew uninstall --cask java
Problem solved 💥
You can clean up old-style cask formulas thus:
grep "cask :v1 =>" --files-with-match /usr/local/Caskroom/*/.metadata/*/*/Casks/*.rb \
| xargs gdirname | xargs gdirname | xargs rm -r
Assuming you've installed coreutils with a g
prefix, so gdirname
runs the GNU flavor of dirname
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With