Skip to content

Instantly share code, notes, and snippets.

@andrewgrewell
Forked from codeinthehole/osx_bootstrap.sh
Last active August 28, 2020 18:40
Show Gist options
  • Save andrewgrewell/9b9f4ab7f2d6a251bd54fdbcfc2b2dcd to your computer and use it in GitHub Desktop.
Save andrewgrewell/9b9f4ab7f2d6a251bd54fdbcfc2b2dcd to your computer and use it in GitHub Desktop.
Script to install stuff I want on a new OSX machine
#!/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
echo "Homebrew installed"
# Update homebrew recipes
brew update
echo "Installing cask..."
brew tap caskroom/cask
# Many brew packages rely on casks, e.g. gradle -> java
CASKS=(
java
adoptopenjdk8
android-sdk
android-ndk
virtualbox
vlc
fastlane
bufbuild/buf
ngrok
)
echo "Installing cask apps..."
brew cask install ${CASKS[@]}
PACKAGES=(
awscli
aws-shell
gnu-tar
httpie
pidcat
pre-commit
jq
ffmpeg
git
git-lfs
carthage
gradle
imagemagick
imagesnap
markdown
node
openssl
watchman
yarn
mysql
redis
postgresql
vim
gpg
hub
)
echo "Installing packages..."
brew install ${PACKAGES[@]}
echo "Cleaning up..."
brew cleanup
echo "Installing Git-Lfs"
git lfs install
# Check for RVM, install if we don't have it
if test ! $(rvm); then
echo "Installing RVM..."
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -L https://get.rvm.io | bash -s stable --autolibs=enabled --ruby
#load ruby for all shells
source $(rvm 2.4.0 do rvm env --path)
rvm install 2.1.2
rvm install 2.4.0
rvm use 2.4.0 --default
fi
echo "Installing Ruby gems"
RUBY_GEMS=(
bundler
filewatcher
)
sudo gem install ${RUBY_GEMS[@]}
if test ! $(ls -a | grep .nvm); then
echo "Installing NVM"
brew unlink node
brew uninstall nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.zshrc
nvm install 12.18.3
fi
echo "Accepting Android SDK Licences"
yes | sdkmanager --licenses
echo "Bootstrapping complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment