Skip to content

Instantly share code, notes, and snippets.

@atipapp
Created June 24, 2019 13:38
Show Gist options
  • Save atipapp/c9e7bf206d50cdccdb5a7468cf87374d to your computer and use it in GitHub Desktop.
Save atipapp/c9e7bf206d50cdccdb5a7468cf87374d to your computer and use it in GitHub Desktop.
Install docker on macOS with brew
#!/usr/bin/env bash
#------------------------------------------------------------------------------
YEL='\033[1;33m'
CYN='\033[0;36m'
GRN='\033[1;32m'
RED='\033[1;31m'
NRM='\033[0m'
function log {
echo -e "${CYN}[${FUNCNAME[1]}]${NRM} $*"
}
function install_darwin_deps {
log "Checking for external dependency: brew"
if [[ -z "$(which brew)" && -n "$(which ruby)" ]]; then
log "'brew' installer not found, attempting to install..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
log "'brew' installation completed."
fi
if [[ "$FORCE" == true ]]; then
log "Updating 'brew'..."
brew update
fi
#-- Spring Tools Suite:
log "Installing/updating external dependency: Docker"
if [[ -n "$FORCE" ]]
then
brew cask reinstall docker
else
brew cask install docker
fi
}
function print_help(){
echo "Use --force to reinstall required dependencies."
}
while [[ "$#" > 0 ]]; do case $1 in
--force) export FORCE=true; shift;;
-h | --help) print_help; exit 0;;
*) echo "Unknown parameter: $1"; exit 1;;
esac; shift; done
install_darwin_deps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment