Skip to content

Instantly share code, notes, and snippets.

@lopezm1
Last active June 11, 2020 05:30
Show Gist options
  • Save lopezm1/16e641918277a4888ee7e88722b2d7dd to your computer and use it in GitHub Desktop.
Save lopezm1/16e641918277a4888ee7e88722b2d7dd to your computer and use it in GitHub Desktop.
Brew Install My Dev Environment for macOS High Sierra - Slack, Docker, iTerm, IntelliJ, Google, SourceTree, Spotify, etc.
#!/bin/bash
APP_FOLDER_LOCATION=/Applications
IFS=""
## Install applications via brew cask
brew_install() {
execute="$(brew cask install $1 2>&1)"
case $execute in
*Warning*|*Error*) echo "Warning while installing $1: $execute" ;;
*successfully*) echo "$execute \n Installed $1." ;;
*) echo "$execute \n Something went wrong while installing $1." ;;
esac
}
check_before_install() {
## Test for existence of the application
if [[ -n $(find $APP_FOLDER_LOCATION -iname $1.app) ]]; then
echo "$1 is already installed. Run - brew cask reinstall <cask-name> - to resinstall the cask."
else
case $1 in
Slack) brew_install slack;;
Docker) brew_install docker;;
iTerm) brew_install iterm2;;
Google\ Chrome) brew_install google-chrome;;
IntelliJ\ Idea) brew_install intellij-idea;;
Sourcetree) brew_install sourcetree;;
Spotify) brew_install spotify;;
Sequel\ Pro) brew_install sequel-pro;;
Visual\ Studio\ Code) brew_install visual-studio-code;;
*) echo "Add $1 to check_before_install() to install additional applications." ;;
## Add the application name to the switch case statement, then pass the cask-name to the brew_install function
## For example: Skype) brew_install skype
## Search for brew casks at https://caskroom.github.io/search
esac
fi
}
# Install Terraform
install_terraform(){
execute="$(brew install terraform 2>&1)"
case $execute in
*brew\ link*)
echo $execute
read -r -p "${1:-Terraform already exists, would you like to overwrite it? [y/N]} " response
case "$response" in
[yY][eE][sS]|[yY])
$(brew link --overwrite terraform);;
*)
echo "Not overwriting terraform.";;
esac;;
*Warning*|*Error*) echo $execute ;;
*Summary*) echo "$execute \n Installed Terraform." ;;
*) echo "$execute \n Something went wrong while installing $1." ;;
esac
}
# Install homebrew
install_homebrew_if_not_present() {
echo "Checking for homebrew installation"
which -s brew
if [[ $? != 0 ]] ; then
echo "Homebrew not found. Installing..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
echo "Homebrew already installed! Updating..."
brew update
fi
}
###
# Main body of script starts here
###
## Install brew and brew cask
install_homebrew_if_not_present
brew update
brew tap caskroom/cask
brew tap caskroom/versions
brew doctor
## Applications we will install with `brew cask install`
## additional applications can be added here if you wish to install them
declare -a applications=( Spotify Sourcetree Slack Docker iTerm "IntelliJ Idea" "Google Chrome" "Sequel Pro" "Visual Studio Code" )
## Check if the application is already installed, install if it's not
for element in ${applications[*]}
do
check_before_install $element
done
## Install Terraform
install_terraform
## Install other miscellaneous tools
brew install git
brew install python #python 3
brew install pyenv
brew install node
brew install coreutils
brew cask install java8
#brew cask install java || if you want the latest version of java
brew install maven
brew install awscli
npm install -g serverless
brew install packer
brew install python2 #python2.7
brew install telnet
## Install oh-my-zsh for iTerm
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
@rroman81
Copy link

you should probably add phpStorm to the mix as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment