Skip to content

Instantly share code, notes, and snippets.

@eripa
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eripa/84e0086c4896d6f6e633 to your computer and use it in GitHub Desktop.
Save eripa/84e0086c4896d6f6e633 to your computer and use it in GitHub Desktop.
OS X bootstrap script for devtools, homebrew and ansible. From http://il.luminat.us/blog/2014/04/19/how-i-fully-automated-os-x-with-ansible/
#!/bin/bash
set -e
SRC_DIRECTORY="$HOME/src"
ANSIBLE_DIRECTORY="$SRC_DIRECTORY/ansible"
ANSIBLE_CONFIGURATION_DIRECTORY="$HOME/.ansible.d"
# Download and install Command Line Tools
if [[ ! -x /usr/bin/gcc ]]; then
echo "Info | Install | xcode"
xcode-select --install
fi
# Download and install Homebrew
if [[ ! -x /usr/local/bin/brew ]]; then
echo "Info | Install | homebrew"
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
fi
# Modify the PATH
export PATH=/usr/local/bin:$PATH
# Download and install zsh
if [[ ! -x /usr/local/bin/zsh ]]; then
echo "Info | Install | zsh"
brew install zsh
fi
# Download and install git
if [[ ! -x /usr/local/bin/git ]]; then
echo "Info | Install | git"
brew install git
fi
# Download and install python
if [[ ! -x /usr/local/bin/python ]]; then
echo "Info | Install | python"
brew install python --framework --with-brewed-openssl
fi
# Download and install Ansible
if [[ ! -x /usr/local/bin/ansible ]]; then
brew install ansible
fi
# Make the code directory
mkdir -p $SRC_DIRECTORY
# Clone down the Ansible repo
if [[ ! -d $ANSIBLE_CONFIGURATION_DIRECTORY ]]; then
git clone git@github.com:eripa/ansible-base-osx.git $ANSIBLE_CONFIGURATION_DIRECTORY
(cd $ANSIBLE_CONFIGURATION_DIRECTORY && git submodule init && git submodule update)
fi
# Provision the box
#ansible-playbook --ask-sudo-pass -i $ANSIBLE_CONFIGURATION_DIRECTORY/inventories/osx $ANSIBLE_CONFIGURATION_DIRECTORY/site.yml --connection=local
# Link the casks.
~/.bin/link-casks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment