VagrantをMac OSXにセットアップ


[bash gutter=”false”]
Vagrant has detected that you have a version of VirtualBox installed
that is not supported. Please install one of the supported versions
listed below to use Vagrant:

4.0, 4.1, 4.2

2014.2.3現在VagrantはVirtualBoxの最新4.3をサポートしていないので、Download VirtualBox (Old Builds): VirtualBox 4.2 よりインストーラをダウンロードしてインストールしました。


[bash gutter=”false”]
$ gem install vagrant
Fetching: archive-tar-minitar-0.5.2.gem (100%)
archive-tar-minitar’s executable "minitar" conflicts with minitar
Overwrite the executable? [yN] y

Done installing documentation for archive-tar-minitar, childprocess, log4r, net-scp, net-ssh, vagrant after 7 seconds
6 gems installed

OS イメージ “box” の追加

[bash gutter=”false”]
vagrant box add {title} {url}

通常利用するようなOSのboxイメージは に公開されています。

Ubuntu 12.04を選択して起動してみます。
[bash gutter=”false”]
$ vagrant box add Ubuntu1204
title にデフォルトの “base” 以外を指定した場合は Vagrantfile に設定が必要です。
[ruby title=”Vagrantfile”] do |config|

# Every Vagrant virtual environment requires a box to build off of.
# = "base" = "Ubuntu1204"

設定後 init して upします。
[bash gutter=”false”]
$ vagrant init
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`` for more information on using Vagrant.
$ vagrant up
[default] Importing base box ‘Ubuntu1204’…
[default] Matching MAC address for NAT networking…
[default] Clearing any previously set forwarded ports…
[default] Forwarding ports…
[default] — 22 => 2222 (adapter 1)
[default] Creating shared folders metadata…
[default] Clearing any previously set network interfaces…
[default] Booting VM…
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
this machine, please update the guest additions and repackage the

Guest Additions Version: 4.1.12
VirtualBox Version: 4.2.22
[default] Mounting shared folders…
[default] — v-root: /vagrant
ssh で起動したboxにアクセスします。
[bash gutter=”false”]
$ vagrant ssh

追記 2014/4/21

[bash gutter=”false”]
$ vagrant box add CentOS_6_5
[vagrant] Downloading with Vagrant::Downloaders::HTTP…
[vagrant] Downloading box:
[vagrant] Downloading box:
[vagrant] Extracting box…
[vagrant] Cleaning up downloaded box…
Failed to untar the box file. This is usually because you’re
attempting to add a box that isn’t a valid box file. Please
double check that the box file is properly packaged.
[bash gutter=”false”]
$ gem update vagrant
Vagrant version 1.0.7
localhost@hrendoh:~ $ gem update vagrant
Updating installed gems
Updating vagrant
Fetching: vagrant-1.5.0.gem (100%)
Thanks for wanting to use Vagrant! Unfortunately, this is not the way
to install Vagrant anymore. We now make installers for the various operating
systems Vagrant supports.

Vagrant is no longer distributed as a RubyGem. Please download the latest
version for your operating system from the URL below. If you still wish
to use the RubyGem version, you can manually install version 1.0.7. Note that
the RubyGem version hasn’t been updated in over a year and will no longer
receive any updates.

Prior to installing Vagrant using the installer, make sure you uninstall
all your Vagrant gems, since they sometimes conflict.

If you want to learn more about why we don’t distribute using RubyGems
anymore, please read this:
Successfully installed vagrant-1.5.0
Parsing documentation for vagrant-1.5.0
Installing ri documentation for vagrant-1.5.0
Installing darkfish documentation for vagrant-1.5.0
Done installing documentation for vagrant after 0 seconds
Gems updated: vagrant

[bash gutter=”false”]
$ gem uninstall vagrant

Select gem to uninstall:
1. vagrant-1.0.7
2. vagrant-1.5.0
3. All versions
> 3
Successfully uninstalled vagrant-1.0.7
Remove executables:

in addition to the gem? [Yn] y
Removing vagrant
Successfully uninstalled vagrant-1.5.0

[bash gutter=”false”]
$ vagrant box add CentOS6.5_64
==> box: Adding box ‘CentOS6.5_64’ (v0) for provider:
box: Downloading:
==> box: Successfully added box ‘CentOS6.5_64’ (v0) for ‘virtualbox’!
[ruby title=”Vagrantfile”]
# = "hashicorp/precise32" = "CentOS6.5_64"
[bash gutter=”false”]
$ vagrant up