Skip to content

Instantly share code, notes, and snippets.

@rafael-garcia
Created January 4, 2015 18:49
Show Gist options
  • Save rafael-garcia/51a953c4396e994086ee to your computer and use it in GitHub Desktop.
Save rafael-garcia/51a953c4396e994086ee to your computer and use it in GitHub Desktop.
#!/bin/bash
fontc=`tput setab 0` # black
back=`tput setaf 2` # green
delim=" %%% "
ColEcho() {
echo "$(tput setab 3)$(tput setaf 4)${delim}${fontc}$1${back}$(tput setab 3)$(tput setaf 4)${delim}"
}
ColEcho "This script will automatically install some dev tools for Mac OS X 10.10 Yosemite"
ColEcho "Getting your username..."
username=`logname`
ColEcho "Hello ${username}"
ColEcho "Would you like to install XCode Command line tools (Y/n)?"
read -n 1 -r dev_xc
dev_xc="${dev_xc:-Y}"
ColEcho "Would you like to install ohmyzsh (Y/n)?"
read -n 1 -r dev_omz
dev_omz="${dev_omz:-Y}"
ColEcho "Would you like to install Homebrew (Y/n)?"
read -n 1 -r dev_brew
dev_brew="${dev_brew:-Y}"
ColEcho "Would you like to install tree (Y/n)?"
read -n 1 -r dev_tree
dev_tree="${dev_tree:-Y}"
ColEcho "Would you like to install ImageMagick (Y/n)?"
read -n 1 -r dev_img
dev_img="${dev_img:-Y}"
ColEcho "Would you like to install nodejs (Y/n)?"
read -n 1 -r dev_nodejs
dev_nodejs="${dev_nodejs:-Y}"
ColEcho "Would you like to install (the latest version) of Git (Y/n)?"
read -n 1 -r dev_git
dev_git="${dev_git:-Y}"
ColEcho "Would you like to install Cask (Y/n)?"
read -n 1 -r dev_cask
dev_cask="${dev_cask:-Y}"
ColEcho "Would you like to install Chrome (Y/n)?"
read -n 1 -r dev_chrome
dev_chrome="${dev_chrome:-Y}"
ColEcho "Would you like to install Sublime Text 3 (Y/n)?"
read -n 1 -r dev_sublime
dev_sublime="${dev_sublime:-Y}"
ColEcho "Would you like to install JDK 8 (Y/n)?"
read -n 1 -r dev_jdk
dev_jdk="${dev_jdk:-Y}"
ColEcho "Would you like to install Eclipse JEE (Y/n)?"
read -n 1 -r dev_eclipse
dev_eclipse="${dev_eclipse:-Y}"
ColEcho "Would you like to install IntelliJ (Y/n)?"
read -n 1 -r dev_intellij
dev_intellij="${dev_intellij:-Y}"
ColEcho "Would you like to install Dropbox (Y/n)?"
read -n 1 -r dev_dropbox
dev_dropbox="${dev_dropbox:-Y}"
ColEcho "Would you like to install Copy (Y/n)?"
read -n 1 -r dev_copy
dev_copy="${dev_copy:-Y}"
ColEcho "Would you like to install Google Drive?"
read -n 1 -r dev_drive
dev_drive="${dev_drive:-Y}"
if [$dev_xc =~ ^[Yy]$]
then
ColEcho "Checking if XCode is already installed"
if [-e /usr/bin/gcc]
then
ColEcho "XCode already installed, skipping"
else
ColEcho "Installing Xcode command line tools"
osascript XcodeToolsInstaller.scpt
fi
else
ColEcho "Skipping Xcode command line tools"
fi
if [$dev_omz =~ ^[Yy]$]
then
ColEcho "Installing OHMYZSH"
sudo -u ${username} curl -L http://install.ohmyz.sh | sh
else
ColEcho "Skipping OHMYZSH"
fi
if [$dev_brew =~ ^[Yy]$]
then
ColEcho "Checking if Homebrew is already installed"
if [-e /usr/local/bin/brew]
then
ColEcho "Homebrew is already installed, skipping"
else
ColEcho "Installing Homebrew"
sudo -u ${username} ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
else
ColEcho "skipping Homebrew"
fi
if [$dev_tree =~ ^[Yy]$]
then
ColEcho "Checking if tree is already installed"
if [-e /usr/local/bin/tree]
then
ColEcho "tree is already installed, skipping"
else
ColEcho "Installing tree"
sudo -u ${username} brew install tree
fi
else
ColEcho "Skipping tree"
fi
if [$dev_img =~ ^[Yy]$]
then
ColEcho "Checking if ImageMagick is already installed"
if [-e /usr/local/bin/convert]
then
ColEcho "ImageMagick is already installed, skipping"
else
ColEcho "Installing ImageMagick"
sudo -u ${username} brew install imagemagick
fi
else
ColEcho "Skipping ImageMagick"
fi
if [$dev_nodejs =~ ^[Yy]$]
then
ColEcho "Checking if nodejs is already installed"
if [-e /usr/local/bin/node]
then
ColEcho "nodejs is already installed, skipping"
else
ColEcho "Installing nodejs"
sudo -u ${username} brew install node
fi
else
ColEcho "Skipping nodejs"
fi
if [$dev_cask =~ ^[Yy]$]
then
ColEcho "Checking if Cask is already installed"
if [-e /usr/local/bin/brew-cask]
then
ColEcho "Cask is already installed, skipping"
else
ColEcho "Installing Cask"
sudo -u ${username} brew install caskroom/cask/brew-cask
sudo -u #{username} brew tap caskroom/versions
fi
else
ColEcho "Skipping Cask"
fi
if [$dev_chrome =~ ^[Yy]$]
then
ColEcho "Checking if Chrome is already installed"
if [-e /Applications/Google\ Chrome.app]
then
ColEcho "Chrome is already installed, skipping"
else
ColEcho "Installing Chrome"
sudo -u ${username} brew cask install google-chrome
fi
else
ColEcho "Skipping Chrome"
fi
if [$dev_sublime =~ ^[Yy]$]
then
ColEcho "Checking if Sublime Text 3 is already installed"
if [-e /Applications/Sublime\ Text.app]
then
ColEcho "Sublime Text 3 is already installed, skipping"
else
ColEcho "Installing Sublime Text 3"
sudo -u ${username} brew cask install sublime-text3
fi
else
ColEcho "Skipping Sublime Text 3"
fi
if [$dev_jdk =~ ^[Yy]$]
then
ColEcho "Checking if JDK 8 is already installed"
if [-e /usr/bin/java]
then
ColEcho "JDK 8 is already installed, skipping"
else
ColEcho "Installing JDK 8"
sudo -u ${username} brew cask install java
fi
else
ColEcho "Skipping JDK 8"
fi
if [$dev_eclipse =~ ^[Yy]$]
then
ColEcho "Checking if Eclipse JEE is already installed"
if [-e /Applications/Eclipse.app]
then
ColEcho "Eclipse JEE is already installed, skipping"
else
ColEcho "Installing Eclipse JEE"
sudo -u ${username} brew cask install eclise-jee
fi
else
ColEcho "Skipping JDK 8"
fi
if [$dev_intellij =~ ^[Yy]$]
then
ColEcho "Checking if IntelliJ is already installed"
if [-e /Applications/Eclipse.app]
then
ColEcho "IntelliJ is already installed, skipping"
else
ColEcho "Installing IntelliJ"
sudo -u ${username} brew cask install intellij-idea
fi
else
ColEcho "Skipping IntelliJ"
fi
if [$dev_intellij =~ ^[Yy]$]
then
ColEcho "Checking if IntelliJ is already installed"
if [-e /Applications/Eclipse.app]
then
ColEcho "IntelliJ is already installed, skipping"
else
ColEcho "Installing IntelliJ"
sudo -u ${username} brew cask install intellij-idea
fi
else
ColEcho "Skipping IntelliJ"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment