$ vagrant up --no-color
Vagrant failed to initialize at a very early stage:
It appears that you've ran a newer version of Vagrant on this
computer. Unfortunately, newer versions of Vagrant change internal
directory layouts that cause older versions to break. This version
of Vagrant cannot properly run.
If you'd like to start from a clean state, please remove the
Vagrant state directory: /Users/twer/.vagrant.d
Warning that this will remove all your boxes and potentially corrupt
existing Vagrant environments that were running based on the future
version.
console中说Vagrant版本有问题,那么就按说明删除.vagrant.d文件夹把。
1
2
3
4
5
6
$ rm -rf ~/.vagrant.d/
$ vagrant up --no-color
/Users/twer/sourcecode/chef-repo/Vagrantfile:8:in `<top (required)>': undefined method `configure' for Vagrant:Module (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/vagrant-1.0.7/lib/vagrant/config/loader.rb:115:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/vagrant-1.0.7/lib/vagrant/config/loader.rb:115:in `block in procs_for_source'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/vagrant-1.0.7/lib/vagrant/config.rb:41:in `block in capture_configures'
窝里个去,又出新问题了。那好吧,看看当前ruby的版本。
1
2
3
4
5
6
7
8
9
10
$ rvm list
rvm rubies
ruby-1.9.2-p320 [ x86_64 ]
=* ruby-1.9.3-p194 [ x86_64 ]
# => - current
# =* - current && default
# * - default
试着将Ruby的版本切换到1.9.2-p320再试试。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ rvm use ruby-1.9.2-p320
Using /usr/local/rvm/gems/ruby-1.9.2-p320
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Setting hostname...
[default] Mounting shared folders...
[default] -- /vagrant
搞定。看来问题是当前使用的ruby的版本有问题。
老是使用旧版本也不是个事,把Ruby升级到最新版本看还有这个问题不。
1
2
3
4
5
6
7
8
9
10
11
$ rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-p374]
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p320]
[ruby-]1.9.3[-p448]
[ruby-]2.0.0-p195
[ruby-]2.0.0[-p247]
[ruby-]2.0.0-head
ruby-head
==> make bootstrap
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[1]: *** [stage1-bubble] Error 2
make: *** [bootstrap] Error 2
READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting
There were package installation errors, make sure to read the log.
Try `brew tap --repair` and make sure `brew doctor` looks reasonable.
通过看log是gcc编译失败,并且通过log可以看出rvm是通过homebrew来安装必备文件的。
通过一番查资料后,找到了解决办法。那就是将Xcode升级到最新版本,然后在Preference里选择Downloads标签,然后安装Command Line Tools。
安装完毕后再用Homebrew安装gcc49。
1
2
3
4
5
6
7
8
9
10
11
12
$ brew install gcc49
==> Downloading ftp://gcc.gnu.org/pub/gcc/snapshots/4.9-20130915/gcc-4.9-20130915.tar.bz2
Already downloaded: /Library/Caches/Homebrew/gcc49-4.9-20130915.tar.bz2
==> ../configure --build=x86_64-apple-darwin12.5.0 --prefix=/usr/local/Cellar/gcc49/4.9-20130915/gcc
==> make bootstrap
==> make install
==> Caveats
This is a snapshot of GCC trunk, which is in active development and
supposed to have bugs and should not be used in production
environment.
==> Summary