Skip to content

Instantly share code, notes, and snippets.

@mikehamer
Last active July 19, 2018 07:33
Show Gist options
  • Save mikehamer/e4964935042e029c7c32 to your computer and use it in GitHub Desktop.
Save mikehamer/e4964935042e029c7c32 to your computer and use it in GitHub Desktop.
OSX Yosemite Setup Script
#!/bin/bash
brews=(
coreutils
findutils
archey
bash
caskroom/cask/brew-cask
dfc
git
git-extras
htop
mackup
mtr
nmap
tmux
wget
zsh
graphicsmagick
rename
zopfli
ffmpeg
python
sshfs
trash
node
tree
ack
)
casks=(
airdroid
asepsis
atom
betterzipql
cakebrew
dropbox
google-chrome
google-drive
hosts
firefox
qlcolorcode
qlmarkdown
qlstephen
quicklook-json
quicklook-csv
java
launchrocket
private-eye
vlc
)
######################################## End of app list ########################################
set +e
echo "Installing Xcode ..."
xcode-select --install
if test ! $(which brew); then
echo "Installing Homebrew ..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
echo "Updating Homebrew ..."
brew update
fi
brew doctor
fails=()
function print_red {
red='\x1B[0;31m'
NC='\x1B[0m' # no color
echo -e "${red}$1${NC}"
}
function install {
cmd=$1
shift
for pkg in $@;
do
exec="$cmd $pkg"
echo "Executing: $exec"
if $exec ; then
echo "Installed $pkg"
else
fails+=($pkg)
print_red "Failed to execute: $exec"
fi
done
}
function proceed_prompt {
read -p "Proceed with installation? " -n 1 -r
if [[ $REPLY =~ ^[Nn]$ ]]
then
exit 1
fi
}
brew info ${brews[@]}
proceed_prompt
install 'brew install' ${brews[@]}
brew tap homebrew/dupes
brew install homebrew/dupes/grep
brew cask info ${casks[@]}
proceed_prompt
install 'brew cask install --appdir="/Applications"' ${casks[@]}
echo "Setting up zsh ..."
curl -L http://install.ohmyz.sh | sh
chsh -s $(which zsh)
# TODO: Auto-set theme to "fino-time" in ~/.zshrc (using antigen?)
curl -sSL https://get.rvm.io | bash -s stable # required for some zsh-themes
echo "Upgrading ..."
pip install --upgrade setuptools
pip install --upgrade pip
gem update --system
echo "Cleaning up ..."
brew cleanup
brew cask cleanup
brew linkapps
for fail in ${fails[@]}
do
echo "Failed to install: $fail"
done
echo "Run `mackup restore` after DropBox has done syncing"
read -p "Hit enter to run [OSX for Hackers] script..." c
sh -c "$(curl -sL https://gist.githubusercontent.com/brandonb927/3195465/raw/osx-for-hackers.sh)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment