Homebrew-Caskでインストール済みのvirtualboxがアップグレード出来なくなっていた

## 対象バージョン

* Mac OS Hight Sierra 10.13.5（17F77)
* Homebrew-Cask 1.6.9
* Homebrew 1.6.9

## 現象

Caskをアップグレードするとvirtualboxのformulaで下記エラーが出るようになっており、また、virtualboxに対して再インストール(reinstall)もアンインストール(uninstall)も受け付けなくなっていました。

```
$ brew cask upgrade
==> Upgrading 2 outdated packages, with result:
virtualbox 5.2.12,122591, virtualbox-extension-pack 5.2.12,122591
==> Satisfying dependencies
==> Downloading https://download.virtualbox.org/virtualbox/5.2.12/VirtualBox-5.2.12-122591-OSX.dmg
######################################################################## 100.0%
==> Verifying checksum for Cask virtualbox
==> Starting upgrade for Cask virtualbox
Error: No such file or directory - brew
Follow the instructions here:
  https://github.com/Homebrew/homebrew-cask#reporting-bugs
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3_2/lib/ruby/2.3.0/open3.rb:199:in `spawn'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3_2/lib/ruby/2.3.0/open3.rb:199:in `popen_run'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3_2/lib/ruby/2.3.0/open3.rb:95:in `popen3'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/system_command.rb:88:in `each_output_line'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/system_command.rb:25:in `run!'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/system_command.rb:14:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/system_command.rb:18:in `run!'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/dsl/base.rb:14:in `system_command'
/usr/local/Caskroom/virtualbox/.metadata/5.2.0-118431/20171103033308.568/Casks/virtualbox.rb:15:in `block (2 levels) in load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/abstract_flight_block.rb:38:in `instance_eval'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/abstract_flight_block.rb:38:in `abstract_phase'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/abstract_flight_block.rb:26:in `uninstall_phase'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:405:in `block in uninstall_artifacts'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3_2/lib/ruby/2.3.0/set.rb:674:in `each'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3_2/lib/ruby/2.3.0/set.rb:674:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:402:in `uninstall_artifacts'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:364:in `start_upgrade'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb:60:in `block in run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb:32:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb:32:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb:31:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:93:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:162:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:127:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:7:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:99:in `<main>'
```

## 対応

エラーが出ているformulaを強制的に上書き。

```
$ brew cask install --force virtualbox

~ 省略 ~

Password: 

~ 省略 ~

installer: Package name is Oracle VM VirtualBox
installer: Installing at base path /
installer: The install was successful.
🍺  virtualbox was successfully installed!
```

再度Caskをアップグレード

```
$ brew cask upgrade
==> Upgrading 1 outdated package, with result:
virtualbox-extension-pack 5.2.12,122591

~ 省略 ~

0%...
10%...20%...30%...40%...50%...60%...70%...80%...90%...
100%
==> Purging files for version 5.2.0-118431 of Cask virtualbox-extension-pack
🍺  virtualbox-extension-pack was successfully upgraded!
```

## 参考

[brew cask reinstal: `Error: No such file or directory - brew` · Issue #44270 · Homebrew/homebrew-cask · GitHub](https://github.com/Homebrew/homebrew-cask/issues/44270)