Created
October 20, 2016 17:08
-
-
Save benjaminoakes/e6fbbb0647b74accce37300c9396c18b to your computer and use it in GitHub Desktop.
Install Docker for Mac
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
#!/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