2

在 OSX El Captain 10.11.6 上,我有

$ VirtualBox --help
Oracle VM VirtualBox Manager 5.0.16

我正在尝试卸载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

有任何想法吗 ?

4

3 回答 3

6

打开终端并运行以下命令

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
于 2018-03-01T00:17:49.163 回答
1
brew uninstall --cask --force virtualbox
于 2021-09-01T04:27:58.703 回答
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 cask

brew cask 卸载 virtualbox

于 2019-04-03T21:34:04.533 回答