brew cask uninstall --force虚拟框给出错误:未定义方法`< ='为零:NilClass

时间:2018-03-01 00:00:40

标签: virtualbox homebrew homebrew-cask

在OSX El Captain 10.11.6上,我有

virtual box

我试图卸载brew cask uninstall --force virtualbox Error: undefined method `<=' for nil:NilClass Did you mean? <=> Follow the instructions here: https://github.com/caskroom/homebrew-cask#reporting-bugs /usr/local/Caskroom/virtualbox/.metadata/5.0.16-105871/20160414170649.906/Casks/virtualbox.rb:2:in `block in load' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:23:in `instance_eval' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:23:in `initialize' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:29:in `new' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:29:in `cask' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:65:in `cask' /usr/local/Homebrew/Library/Homebrew/compat/hbc/cask_loader.rb:10:in `cask' /usr/local/Caskroom/virtualbox/.metadata/5.0.16-105871/20160414170649.906/Casks/virtualbox.rb:1:in `load' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:55:in `instance_eval' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:55:in `load' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:168:in `load' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb:19:in `block in run' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb:12:in `each' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb:12:in `run' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb:35:in `run' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:98:in `run_command' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:168:in `run' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:132:in `run' /usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask' /usr/local/Homebrew/Library/Homebrew/brew.rb:100:in `<main>' 但是要关注...

cat /usr/local/Caskroom/virtualbox/.metadata/5.0.16-105871/20160414170649.906/Casks/virtualbox.rb

这是抱怨的文件的第一行:

cask 'virtualbox' do if MacOS.release <= :lion

{{1}}

有什么想法吗?

2 个答案:

答案 0 :(得分:2)

打开终端并运行以下命令

brew update
brew cleanup

删除所有使用brew的包

brew cask rm virtualbox --force
brew cask rm vagrant --force
brew cask rm vagrant-manager --force

删除可能遗漏的所有现有软件包

rm -rf /Applications/Vagrant* /Applications/VirtualBox
sudo rm -f /usr/bin/vagrant /usr/local/bin/vagrant
sudo rm -rf /opt/vagrant /opt/homebrew-cask/Caskroom/va* /opt/homebrew-cask/Caskroom/virtualbox
rm -rf ~/.vagrant* ~/.docker ~/Virtual*
rm -rf /usr/local/Caskroom/virtualbox && rm -rf /Applications/VirtualBox.app/
sudo pkgutil --forget com.vagrant.vagrant

更新: 如果您想重新安装它,请运行以下命令

brew cleanup
brew update --rebase
brew upgrade --cleanup
brew install vagrant-completion --force
brew cask install virtualbox --force
brew cask install vagrant --force
brew cask install vagrant-manager --force
brew upgrade --cleanup
brew cleanup
brew doctor
sudo shutdown -r now

答案 1 :(得分:0)

从旧的virtualbox.rb脚本中删除对MacOS.release的有害调用后,卸载virtualbox对我有用。该文件应为以下信息:

/usr/local/Caskroom/virtualbox/.metadata/5.0.14-105127/20160220202816.699/Casks/virtualbox.rb

使用文本编辑器删除if语句,仅保留选择已安装的5.0.14版本的分支。 之后,brew应该能够解析,然后使用简单的

卸载旧的virtualbox桶。

酒桶卸载虚拟机