Skip to content

Instantly share code, notes, and snippets.

@gregjlee
Last active May 4, 2019 08:10
Show Gist options
  • Save gregjlee/d3d5df249114eb03533ba5c0d2753e4b to your computer and use it in GitHub Desktop.
Save gregjlee/d3d5df249114eb03533ba5c0d2753e4b to your computer and use it in GitHub Desktop.
osx bootstrap
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Twitter (app store)
# - Postgres.app (http://postgresapp.com/)
#
# 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/
echo "Starting bootstrapping"
# Check for xcode, install if we don't have it
# It is needed before the rest of the script is run
if test ! $(xcode-select -p); then
echo "Installing xcode tools...Rerun script after"
xcode-select --install
exit 1
fi
# 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
# Install GNU core utilities (those that come with OS X are outdated)
# brew tap homebrew/dupes
# brew install coreutils
# brew install gnu-sed --with-default-names
# brew install gnu-tar --with-default-names
# brew install gnu-indent --with-default-names
# brew install gnu-which --with-default-names
# brew install gnu-grep --with-default-names
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
# brew install findutils
# Install Bash 4
# brew install bash
PACKAGES=(
git
heroku/brew/heroku #rails hosting service
bash-completion #git autocomplete
markdown
mysql
nvm #node version manager
postgresql
python3
rbenv #ruby environment manager
swiftlint
wget
yarn --ignore-dependencies #node package manager, but lets nvm control node version
)
echo "Installing packages..."
brew install ${PACKAGES[@]}
echo "Cleaning up..."
brew cleanup
CASKS=(
1password
appcode
dbeaver-community #database visualizer
charles #network requests viewer
dash #offline software documentation
docker
firefox
flux #screen dimmer
flycut #copy paste manager
google-chrome
harvest #time keeping for contracting
java #needed for flyway
postico #postgreSQL gui
sequel-pro
skype
slack
sourcetree
spectacle #move windows around with shortcuts
spotify
sublime-text
visual-studio-code
vlc #video player
zeplin #shared designs
zoomus #video conference
)
echo "Installing cask apps..."
brew cask install ${CASKS[@]}
brew install flyway #database migration helper, needed to install after java^
echo "Installing fonts..."
brew tap caskroom/fonts
FONTS=(
font-roboto
font-clear-sans
)
brew cask install ${FONTS[@]}
#should setup renv first before installing gems
#echo "Installing Ruby gems"
#RUBY_GEMS=(
# cocoapods #ios package manager
# bundler #ruby gem manager
#)
#sudo gem install ${RUBY_GEMS[@]}
echo "Configuring OSX..."
# Show filename extensions by default - do these work?
# defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Enable tap-to-click - not sure if these actually work?
# defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
# defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
#show hidden finles in finder
defaults write com.apple.finder AppleShowAllFiles YES
# echo "Creating folder structure..."
# [[ ! -d Wiki ]] && mkdir Wiki
# [[ ! -d Workspace ]] && mkdir Workspace
echo "Bootstrapping complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment