我在 mac osx 10.6 机器上安装了 Virtual Box 4.1.6 和 vagrant-0.8.8。当我运行 vagrant 时,它会提示 Virtual Box 未安装。你知道该如何告诉 vagrant Virtual Box 在哪里吗?
这就是我安装一切的方式:
流浪汉:
$ sudo gem install vagrant
Successfully installed vagrant-0.8.8
虚拟盒子宝石:
$ sudo gem install virtualbox
Successfully installed virtualbox-0.9.2
虚拟盒本身:
$ curl -O http://download.virtualbox.org/virtualbox/4.1.6/VirtualBox-4.1.6-74713-OSX.dmg
.. 通过 GUI 安装 ...
$ /Applications/VirtualBox.app/Contents/MacOS/VirtualBox --help | grep Manager
Oracle VM VirtualBox Manager 4.1.6
最后,Virtualbox 给出错误:
$ vagrant
Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed.
If VirtualBox is installed, it may be an incorrect version. Vagrant currently
requires VirtualBox 4.1.x. Please install the proper version to continue.
If you have an older or newer version of VirtualBox, please make sure you're
using the proper version of Vagrant. Ask the mailing list if you have questions.
我已经通过 virtualbox gem 查找了所有路径:
$ grep -R "Contents/MacOS" *
lib/virtualbox/com/ffi_interface.rb: lib_path ||= "/Applications/VirtualBox.app/Contents/MacOS/VBoxXPCOMC.dylib"
lib/virtualbox/lib.rb: @@lib_path = Dir.glob("/Applications/{,MacPorts/}VirtualBox.app/Contents/MacOS/VBoxXPCOMC.dylib")
test/virtualbox/lib_test.rb: result = ["/Applications/VirtualBox.app/Contents/MacOS/VBoxXPCOMC.dylib"]
该文件在我的系统中存在:
$ ls -alh /Applications/VirtualBox.app/Contents/MacOS/VBoxXPCOMC.dylib
-rwxr-xr-x 1 root admin 93K 4 Nov 12:38 /Applications/VirtualBox.app/Contents/MacOS/VBoxXPCOMC.dylib
我在github上看到了这个问题:https://github.com/mitchellh/vagrant/issues/562过去两周内其他人也遇到过这个问题。它提到前一个人的 vargrant gem 版本已过期,但我使用的是 0.8.8。
答案1
我也遇到了同样的问题。我通过使用 sudo 运行 vagrant 解决了这个问题:
sudo vagrant