Installation Overview
To use Vagrant with VirtualBox you need two things installed on your host machine — VirtualBox (the hypervisor) and Vagrant (the orchestration tool). Both are free and available for macOS, Windows, and Linux.
Install on macOS
Step 1 — Install VirtualBox
BASH — Install VirtualBox (macOS)
# Option 1: Download from official site
# https://www.virtualbox.org/wiki/Downloads
# Download the macOS .dmg and install
# Option 2: Using Homebrew (recommended)
brew install --cask virtualbox
# Verify
VBoxManage --version
⚠ Warning: On macOS Sonoma/Ventura you may need to allow VirtualBox in System Settings → Privacy & Security → Allow after installation.
Step 2 — Install Vagrant
BASH — Install Vagrant (macOS)
# Option 1: Download from official site
# https://developer.hashicorp.com/vagrant/downloads
# Download the macOS .dmg and install
# Option 2: Using Homebrew (recommended)
brew install --cask vagrant
# Verify
vagrant --version
Step 3 — Install Vagrant VirtualBox Plugin (optional but recommended)
BASH — Vagrant Plugins
# Install VirtualBox guest additions plugin
vagrant plugin install vagrant-vbguest
# Verify plugins
vagrant plugin list
Install on Windows
Step 1 — Install VirtualBox
BASH — Install VirtualBox (Windows)
# Download from:
# https://www.virtualbox.org/wiki/Downloads
# Run the Windows installer (.exe)
# Or using Chocolatey
choco install virtualbox
# Verify in PowerShell
VBoxManage --version
Step 2 — Install Vagrant
BASH — Install Vagrant (Windows)
# Download from:
# https://developer.hashicorp.com/vagrant/downloads
# Run the Windows installer (.msi) — requires restart
# Or using Chocolatey
choco install vagrant
# Verify in PowerShell
vagrant --version
Install on Linux (RHEL/OEL 8)
BASH — Install on OEL/RHEL 8
# Install VirtualBox
sudo dnf install -y kernel-devel kernel-headers dkms
sudo rpm --import https://www.virtualbox.org/download/oracle_vbox.asc
sudo curl -o /etc/yum.repos.d/virtualbox.repo https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo
sudo dnf install -y VirtualBox-7.0
# Install Vagrant
sudo rpm --import https://rpm.releases.hashicorp.com/gpg
sudo curl -o /etc/yum.repos.d/hashicorp.repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo dnf install -y vagrant
# Verify
VBoxManage --version
vagrant --version
Verify Full Installation
BASH — Verify Installation
# Check Vagrant version
vagrant --version
# Check VirtualBox version
VBoxManage --version
# Check Vagrant can see VirtualBox
vagrant status
# List available boxes (empty on fresh install)
vagrant box list
Directory Structure
Vagrant stores its data in these locations:
| Location | Purpose |
|---|---|
| ~/.vagrant.d/ | Vagrant home — boxes, plugins, data |
| ~/.vagrant.d/boxes/ | Downloaded box images stored here |
| ~/.vagrant.d/plugins.json | Installed plugins list |
| ./Vagrantfile | Your project config (per project) |
| ./.vagrant/ | Per-project VM state (auto-created) |
💡 Note: The .vagrant/ folder in your project directory should be added to .gitignore — it contains machine-specific state that should not be committed.
BASH — .gitignore for Vagrant
# Create .gitignore for Vagrant projects
cat > .gitignore << EOF
.vagrant/
*.log
*.box
EOF