Last active
August 29, 2015 14:24
-
-
Save 23inhouse/1a6ecaca9f67c6f07899 to your computer and use it in GitHub Desktop.
New developer setup script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" | |
We need to escape \$PATH
here: echo "export PATH=$PATH:~/bin/" >> ~/.bash_profile
We need to allow command line tools installation to fail in case they are already installed
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
brew
installation complains if is already installed. Fixable by which brew || ruby -e ...
brew install go
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
line
eval "$(docker-machine env dev)" && ~/bin/docker ps
doesn't work because it assumesdocker-machine
is on path.Should be fixed to
eval "$(~/bin/docker-machine env dev)" && ~/bin/docker ps