Preparing Vagrant Yosemite box

Installing from the cloud

ssh scg@scgmini; cd /Users/scg/deployment/vagrant/projects/yosemite
vagrant init jhcook/osx-yosemite-10.10
vagrant up

At this point vagrant created default Vagrantfile, downloaded and imported the box, but failed to load it.

  • Tuning vagrant file at /Users/scg/deployment/vagrant/projects/yosemite/Vagrantfile
    # -*- mode: ruby -*-
    # vi: set ft=ruby :
    
    Vagrant.configure(2) do |config|
      config.vm.box = "jhcook/osx-yosemite-10.10" 
    
      config.vm.synced_folder '.', '/vagrant', disabled: true
      config.vm.network "private_network", ip: "10.10.20.15" 
    
    config.vm.provider "virtualbox" do |vb|
      vb.customize ["modifyvm", :id, "--memory", "8192"]
      vb.customize ["modifyvm", :id, "--cpus", 2]
      vb.customize ["modifyvm", :id, "--audio", "none", "--usb", "on", "--usbehci", "off"]
    end
    
    end
    

vagrant reload
At this point box should be running. You can in principle go to macmini desktop, login, call Virtualbox and see running box in the list.

Updating the box

  • Applying Apple updates

ssh scg@scgmini; cd /Users/scg/deployment/vagrant/projects/yosemite-dev
vagrant ssh # password "vagrant"
softwareupdate --install --all # password "vagrant"
exit

  • Updating for the second time

vagrant reload; vagrant ssh
softwareupdate --install --all # password "vagrant"
exit

  • Modifying authorized_keys in the box with the key from server

vagrant ssh; cd .ssh
scp sch@scgmini:./.ssh/id_rsa.pub to .ssh/authorized_keys
scp sch@scgmini:./.ssh/id_rsa to .ssh/id_rsa

this is required because we use ssh to send dmg installer from the box back to the build server

  • Installing homebrew in the box

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Edit .profile and add there GITHUB API token

Installing xcode in the box

  • Go to macmini desktop, run Virtualbox, connect to already running Yosemite box
  • Donwload XCode 7.2.1 from https://developer.apple.com/download (Apple developer ID is required)
  • Install XCode;

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license
exit

  • vagrant reload
Install BornAgain dependencies in the box
  • brew install llvm
  • brew install git cmake fftw gsl python homebrew/python/matplotlib numpy boost libtiff eigen libyaml yaml-cpp
  • Install Anaconda2 from dmg (using desktop)
  • Install Qt5 from online installer (using desktop)
Packaging box
  • Packaging box

vagrant package --output osx-yosemite-dev-1.0.box
mv osx-yosemite-dev-1.0.box ~/deployment/vagrant/orig_boxes/.
vagrant destroy
Removing original box
vagrant box remove jhcook/osx-yosemite-10.10

  • Adding just created box

vagrant box add yosemite-dev /Users/scg/deployment/vagrant/orig_boxes/osx-yosemite-dev-1.0.box

  • Running box for the first time

vagrant up --no-provision
vagrant ssh; exit
vagrant provision # check how provisioning working, compilation should start

Here box is ready

exit
vagrant destroy