Skip to content

Instantly share code, notes, and snippets.

@benjaminoakes
Created October 20, 2016 17:08
Show Gist options
  • Save benjaminoakes/e6fbbb0647b74accce37300c9396c18b to your computer and use it in GitHub Desktop.
Save benjaminoakes/e6fbbb0647b74accce37300c9396c18b to your computer and use it in GitHub Desktop.
Install Docker for Mac
#!/bin/sh
log_info() {
echo "[info] $*"
}
log_warn() {
echo "[warn] $*"
}
install_xcode_cli() {
xcode-select --install 2> /dev/null
if [ $? == 1 ]; then
log_info "Xcode CLI installed"
else
log_warn "Unexpected exitstatus when installing Xcode CLI"
exit 1
fi
}
install_homebrew() {
if [ -f /usr/local/bin/brew ]; then
log_info "Homebrew installed"
else
log_info "Installing Homebrew"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
}
brew_install() {
package_name="$1"
log_info "Installing $package_name"
brew install "$package_name"
}
brew_cask_install() {
package_name="$1"
log_info "Installing $package_name"
brew tap caskroom/cask
brew cask install "$package_name"
}
install_xcode_cli
install_homebrew
# You can install more than just docker here (e.g. Chrome, Firefox, etc)
brew_cask_install 'docker'
brew prune
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment