GIST_URL='https://gist.github.com/0x414A/0d5303b787a449cd564f/raw' setup_shell() { [ -f ~/.profile ] && \ mv ~/.profile{,.backup} && \ echo "Created backup of existing ~/.profile to ~/.profile.backup" curl $GIST_URL/profile -o ~/.profile && echo "Setup $SHELL" if [[ $SHELL == *"zsh"* ]]; then [ -f ~/.zprofile ] && mv ~/.zprofile{,.backup} curl $GIST_URL/zprofile -o ~/.zprofile fi } setup_docker_machine() { ## Prerequisites echo 'Installing xhyve, docker, docker-compose, and go' brew update brew install xhyve docker go brew install docker-compose --without-docker-machine --without-docker ## Set up Go echo 'Setting up go directories' mkdir ~/.go ## Set up shell if [[ $SHELL == *"zsh"* ]]; then shellrc=$HOME/.zshrc else shellrc=$HOME/.bash_profile fi echo 'export GOPATH=$HOME/.go' >> $shellrc export GOPATH=$HOME/.go ## Install docker-machine go get github.com/docker/machine cd $GOPATH/src/github.com/docker/machine make build make install ## Install docker-machine xhyve export GO15VENDOREXPERIMENT=1 go get -u github.com/zchee/docker-machine-driver-xhyve cd $GOPATH/src/github.com/zchee/docker-machine-driver-xhyve make build make install sudo chown root:wheel $GOPATH/bin/docker-machine-driver-xhyve sudo chmod u+s $GOPATH/bin/docker-machine-driver-xhyve ## Create the xhyve machine docker-machine create dev --driver xhyve --xhyve-experimental-nfs-share mkdir -p ~/Library/LaunchAgents curl $GIST_URL/com.docker.machine.dev.plist -o\ ~/Library/LaunchAgents/com.docker.machine.dev.plist && \ echo "Setup docker-machine to launch on startup" } setup_docker_machine setup_shell echo "Now, reboot."