Here is a quick way to setup VirtualBox using Vagrant with Heroku-like box on Mac.

  1. Install VirtualBox from https://www.virtualbox.org/wiki/Downloads

  2. Install Vagrant from http://downloads.vagrantup.com/

  3. Create Vagrantfile for Heroku-like box (based on https://github.com/ejholmes/vagrant-heroku) that looks something like:

1
2
3
4
5
6
    Vagrant.configure("2") do |config|
        config.vm.box = "heroku"
        config.vm.box_url = "https://dl.dropboxusercontent.com/s/rnc0p8zl91borei/heroku.box"
        config.vm.synced_folder ".", "/vagrant", :nfs => true
        config.vm.network :private_network, ip: "192.168.1.42"  # required for NFS
    end

Beside telling Vagrant to use Heroku-like box from https://github.com/ejholmes/vagrant-heroku it also sets up shared dir between host and VM machine. It will mount Vagrantfile dir (.) to /vagrant in VM.

vagrant up will setup the VM and start it up.

Now you can use vagrant ssh to login to VM.

Vagrant Heroku-like box comes with Postgresql, but if you want you can easily setup sqlite:

1
sudo apt-get install libsqlite3-dev

Bonus tip: when you are working on multiple projects sometimes you can forget which VMs are running. You can list all running VMs using:

1
VBoxManage list runningvms

Further reading:

Comments