今天在执行brew upgrade
的时候出现如下错误:
1 2 3 4 |
$ brew upgrade Updating Homebrew... Error: Cask 'java7' is unreadable: undefined method `undent' for #<String:0x00007fcff5421ec8> |
原因为某次更新之后,配置文件增加了某些不必要的字段。更要命的是,不能执行卸载命令来删除出问题的安装包。解决方法为删除这个字段。
方案如下:
1 2 3 4 5 6 7 8 9 10 11 |
$ find "$(brew --prefix)/Caskroom/"java7'/.metadata' -type f -name '*.rb' | xargs grep 'EOS.undent' --files-with-matches | xargs sed -i '' 's/EOS.undent/EOS/' $ find "$(brew --prefix)/Caskroom/"java'/.metadata' -type f -name '*.rb' | xargs grep 'EOS.undent' --files-with-matches | xargs sed -i '' 's/EOS.undent/EOS/' $ brew uninstall java7 $ brew cleanup $ brew update $ brew upgrade |