Skip to content

Instantly share code, notes, and snippets.

@Nebula83
Last active August 29, 2018 18:47
Show Gist options
  • Save Nebula83/704c1e676e44c3d61362402e469a1291 to your computer and use it in GitHub Desktop.
Save Nebula83/704c1e676e44c3d61362402e469a1291 to your computer and use it in GitHub Desktop.
Bootstrap script
#!/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:
# magnet (app store, bought)
#
#
# 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 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/core
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
maven
python3
)
echo "Installing packages..."
brew install ${PACKAGES[@]}
echo "Cleaning up..."
brew cleanup
echo "Installing cask..."
#brew install caskroom/cask/brew-cask
brew tap caskroom/cask
brew tap caskroom/versions
CASKS=(
java8
android-file-transfer
dropbox
gitkraken
spotify
toggl
teamviewer
google-chrome
macvim
vlc
)
echo "Installing cask apps..."
brew cask install ${CASKS[@]}
echo "Installing fonts..."
brew tap caskroom/fonts
FONTS=(
font-fira-code
)
brew cask install ${FONTS[@]}
echo "Configuring OSX..."
# Set fast key repeat rate
defaults write NSGlobalDomain KeyRepeat -int 0
# Show filename extensions by default
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Disable "natural" scroll
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
echo "Creating folder structure..."
[[ ! -d ~/development ]] && mkdir ~/development
echo "Bootstrapping complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment