Skip to content

Instantly share code, notes, and snippets.

@23inhouse
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save 23inhouse/1a6ecaca9f67c6f07899 to your computer and use it in GitHub Desktop.
Save 23inhouse/1a6ecaca9f67c6f07899 to your computer and use it in GitHub Desktop.
New developer setup script
#!/usr/bin/env bash
set -e
## Developer Environment
# setup
mkdir ~/setup
cd ~/setup
mkdir ~/bin
echo "export PATH=$PATH:~/bin/" >> ~/.bash_profile
## VirtualBox
# http://slaptijack.com/system-administration/os-x-cli-install-virtualbox/
curl http://download.virtualbox.org/virtualbox/4.3.28/VirtualBox-4.3.28-100309-OSX.dmg > VirtualBox.dmg
hdiutil mount VirtualBox.dmg
sudo installer -pkg /Volumes/VirtualBox/VirtualBox.pkg -target /
hdiutil unmount /Volumes/VirtualBox/
rm VirtualBox.dmg
## Docker-machine
# https://docs.docker.com/machine/
curl -L https://github.com/docker/machine/releases/download/v0.3.0/docker-machine_darwin-amd64 > ~/bin/docker-machine
chmod +x ~/bin/docker-machine
~/bin/docker-machine
curl -L https://get.docker.com/builds/Darwin/x86_64/docker-latest > ~/bin/docker
chmod +x ~/bin/docker
~/bin/docker-machine create --driver virtualbox dev
eval "$(docker-machine env dev)" && ~/bin/docker ps
## xcode tools
echo "install xcode commandline tools"
echo "Press install, agree and follow the prompts and then Done."
xcode-select --install
## homebrew
# http://brew.sh/
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew -v
## tunnelblick
# https://code.google.com/p/tunnelblick/
curl http://netcologne.dl.sourceforge.net/project/tunnelblick/All%20files/Tunnelblick_3.5.2_build_4270.4346.dmg > Tunnelblick.dmg
hdiutil mount Tunnelblick.dmg
open /Volumes/Tunnelblick/Tunnelblick.app
hdiutil unmount /Volumes/Tunnelblick/
rm Tunnelblick.dmg
## golang
brew install golang
## public ssh key
# https://help.github.com/articles/generating-ssh-keys/
mkdir -p ~/.ssh
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa
# cleanup
cd ~
rmdir ~/setup
echo "To use docker please run 'eval \"\$(docker-machine env dev)\"'"
echo "Please open a new tab to load the bash_profile"
@alex-fedorov
Copy link

line eval "$(docker-machine env dev)" && ~/bin/docker ps doesn't work because it assumes docker-machine is on path.

Should be fixed to eval "$(~/bin/docker-machine env dev)" && ~/bin/docker ps

@alex-fedorov
Copy link

We need to escape \$PATH here: echo "export PATH=$PATH:~/bin/" >> ~/.bash_profile

@alex-fedorov
Copy link

We need to allow command line tools installation to fail in case they are already installed

@alex-fedorov
Copy link

It is not enough to use open for tunnelblick. Since it is executed asynchronously and by the time we try to unmount volume it is still running and make script fail with Resource is busy. Solution is to launch an app directly:

/Volumes/Tunnelblick/Tunnelblick.app/Contents/MacOS/Tunnelblick

@alex-fedorov
Copy link

brew installation complains if is already installed. Fixable by which brew || ruby -e ...

@alex-fedorov
Copy link

brew install go

@alex-fedorov
Copy link

Fixes here: https://gist.github.com/alex-fedorov/479c668dc8348ef177a9

Now we should try to run it on clean mac and see if it can do it in one run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment