Skip to content

Instantly share code, notes, and snippets.

@montanaflynn
Last active July 26, 2017 00:11
Show Gist options
  • Save montanaflynn/9da08bb304cd9bfac50f to your computer and use it in GitHub Desktop.
Save montanaflynn/9da08bb304cd9bfac50f to your computer and use it in GitHub Desktop.
Shell script to setup OSX yosemite
#!/usr/bin/env bash
# Ask for sudo up front
echo "Some steps require sudo so please enter your password"
sudo -v
# Check for and install developer tools
xcode-select -p
if [ $? -ne 0 ]; then
# Install dev tools
echo "Installing developer tools"
xcode-select --install
sudo xcode-select --switch /Library/Developer/CommandLineTools
fi
# Oh my zsh installation
if [ ! -d "$HOME/.oh-my-zsh" ]; then
echo "Installing oh-my-zsh"
curl -L http://install.ohmyz.sh | sh
fi
# zsh fix
if [[ -f /etc/zshenv ]]; then
echo "Fixing OSX zsh environment bug"
sudo mv /etc/{zshenv,zshrc}
fi
# Homebrew installation
if ! command -v brew &>/dev/null; then
echo "Installing Homebrew, an OSX package manager, follow the instructions"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
if ! grep -qs "recommended by brew doctor" ~/.zshrc; then
echo "Put Homebrew location earlier in PATH "
printf '\n# recommended by brew doctor\n' >> ~/.zshrc
printf 'export PATH="/usr/local/bin:$PATH"\n' >> ~/.zshrc
export PATH="/usr/local/bin:$PATH"
fi
fi
# Homebrew update
echo "Updating brew formulas"
brew update
# Homebrew upgrade OSX tools
echo "Installing the most recent verions of some OSX tools"
brew tap homebrew/dupes
brew install homebrew/dupes/grep
# Homebrew set PATH
echo "Adding brew to zsh and PATH"
printf 'export PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"' >> ~/.zshrc
export PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"
# OpenSSL install and link
echo "Installing and linking OpenSSL"
brew install openssl
brew link openssl --force
# Install brews
brews=(
coreutils
findutils
gcc
git
node
vim
imagemagick
ffmpeg
caskroom/cask/brew-cask
launchrocket
)
for brew in "${brews[@]}"
do
echo "Installing $brew"
brew install $brew
done
# Install apps
apps=(
flowdock
spotify
google-chrome
mou
iterm2
sublime-text
vlc
tomighty
clipmenu
quicksilver
)
for app in "${apps[@]}"
do
brew cask install --appdir="/Applications" $app
done
# Install cask fonts
echo "Installing some caskroom/fonts"
brew tap caskroom/fonts
fonts=(
font-roboto
font-open-sans
font-lato
font-alegreya
font-montserrat
font-inconsolata
font-quicksand
font-raleway
font-ubuntu
)
# Install the fonts
echo "Installing the fonts"
brew cask install ${fonts[@]}
echo "Finsihed setting up your mac!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment