LoginSignup
5
1

More than 3 years have passed since last update.

brew caskでVirtualBoxとVagrantをインストールしたらVagrantのバージョン対応でハマった

Last updated at Posted at 2019-12-26

環境

項目 バージョン
OS mac OS Mojave 10.14.6
VirtualBox 6.1.0,135406
Vagrant 2.2.6

事象

vagrant up 時、以下のエラーが発生。

No usable default provider could be found for your system.

Vagrant relies on interactions with 3rd party systems, known as
"providers", to provide Vagrant with resources to run development
environments. Examples are VirtualBox, VMware, Hyper-V.

The easiest solution to this message is to install VirtualBox, which
is available for free on all major platforms.

If you believe you already have a provider available, make sure it
is properly installed and configured. You can see more details about
why a particular provider isn't working by forcing usage with
`vagrant up --provider=PROVIDER`, which should give you a more specific
error message for that particular provider.

原因

2019/12/26現在、VagrantがVirtualBoxの最新バージョン6.1に対応していなかったため。

以下のコマンドで対応バージョンを確認しました。

$ vagrant up --provider=virtualbox

コマンド実行結果。

The provider 'virtualbox' that was requested to back the machine
'default' is reporting that it isn't usable on this system. The
reason is shown below:

Vagrant has detected that you have a version of VirtualBox installed
that is not supported by this version of Vagrant. Please install one of
the supported versions listed below to use Vagrant:

4.0, 4.1, 4.2, 4.3, 5.0, 5.1, 5.2, 6.0

A Vagrant update may also be available that adds support for the version
you specified. Please check www.vagrantup.com/downloads.html to download
the latest version.

解決法

方法1. Vagrantのファイルを編集

Vagrantのファイルを編集して、VirtualBox 6.1をproviderとして認識させます。

[Mac] Vagrant 2.2.6 と Virtualbox 6.1でうまくvagrant up ができなかった時の対処法 - Qiita

方法2. VirtualBoxのダウングレード

VirtualBoxを、Vagrantが対応するバージョンにダウングレードします。
今回は6.0にダウングレードしました。

  1. brew caskでインストールしたVirtualBoxをアンインストール

    $ brew cask uninstall virtualbox
    
  2. VirtualBox公式サイトVirtualBox older buildsからバージョン6.0のdmgファイルをダウンロードし、インストール

※brew caskでバージョンを指定してインストールする方法もありますが、 brew cask upgrade すると問題が再発します。

終わりに

今回はVagrant側のファイル修正で対処可能でしたが、今後対処できなくなるとも限りません。
依存するアプリケーションがあり、バージョンを固定する必要がある場合は brew cask を使わない方が良さそうですね。勉強になりました。

5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1