Skip to content

Instantly share code, notes, and snippets.

@p2
Created November 11, 2016 17:18
Show Gist options
  • Save p2/7cb15148758d098e71116dd40612b245 to your computer and use it in GitHub Desktop.
Save p2/7cb15148758d098e71116dd40612b245 to your computer and use it in GitHub Desktop.
Let Vagrant set up an Ubuntu Xenial VM with Swift installed
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
# Create a shared folder for easy development
config.vm.synced_folder "../Ubuntu-Share", "/macOSshare"
config.vm.provision "shell", inline: <<-CMD
sudo apt-get update
sudo apt-get --assume-yes install clang libicu-dev libcurl3 libpython2.7
# load and unpack Swift
curl -O https://swift.org/builds/swift-3.0.1-release/ubuntu1604/swift-3.0.1-RELEASE/swift-3.0.1-RELEASE-ubuntu16.04.tar.gz
tar zxf swift-3.0.1-RELEASE-ubuntu16.04.tar.gz
# sudo chown -R vagrant:vagrant swift-* # seemed necessary in trusty, no `vagrant` user in xenial?
echo "export PATH=/home/ubuntu/swift-3.0.1-RELEASE-ubuntu16.04/usr/bin:\"${PATH}\"" >> .profile
echo "Swift has successfully installed on Linux"
CMD
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment