Skip to content

Instantly share code, notes, and snippets.

@ruddra
Created July 12, 2018 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruddra/642b5aa4d36500c923e885831930e593 to your computer and use it in GitHub Desktop.
Save ruddra/642b5aa4d36500c923e885831930e593 to your computer and use it in GitHub Desktop.
osx_bootstrap_2.sh
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Notes:
#
# - If installing full Xcode, it's better to install that first from the app
# store before running the bootstrap script. Otherwise, Homebrew can't access
# the Xcode libraries as the agreement hasn't been accepted yet.
#
# Reading:
#
# - http://lapwinglabs.com/blog/hacker-guide-to-setting-up-your-mac
# - https://gist.github.com/MatthewMueller/e22d9840f9ea2fee4716
# - https://news.ycombinator.com/item?id=8402079
# - http://notes.jerzygangi.com/the-best-pgp-tutorial-for-mac-os-x-ever/
#
# TODO:
# - write command results to log file for fixing any installs that failed / setting up ENV
echo "Starting bootstrapping"
# Check for Homebrew, install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# Update homebrew recipes
brew update
echo "Installing cask..."
brew tap caskroom/cask
# Many brew packages rely on casks, e.g. gradle -> java
CASKS=(
java
virtualbox
dropbox
firefox
flux
iterm2
macvim
skype
slack
spectacle
spotify
)
echo "Installing cask apps..."
brew cask install ${CASKS[@]}
brew cask install caskroom/versions/java8
PACKAGES=(
git
markdown
node
openssl
yarn
mysql
redis
vim
python
python3
pypy
vim
wget
mysql-connector-c
)
echo "Installing packages..."
brew install ${PACKAGES[@]}
echo "Cleaning up..."
brew cleanup
echo "Installing node versions"
sudo n latest
sudo n stable
sudo n 4.7.3
sudo n 6.11.5
echo "Setting up handy cli commands..."
git config --global alias.up 'pull --rebase --autostash'
echo "Bootstrapping complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment