Skip to content

Instantly share code, notes, and snippets.

@andrewharmellaw
Forked from codeinthehole/osx_bootstrap.sh
Last active January 8, 2021 09:46
Show Gist options
  • Save andrewharmellaw/71e76430661dc095a252ecc2892d12dc to your computer and use it in GitHub Desktop.
Save andrewharmellaw/71e76430661dc095a252ecc2892d12dc 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.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - TBC
#
# 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)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
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
PACKAGES=(
#ack
#autoconf
#automake
#boot2docker
#ffmpeg
#gettext
#gifsicle
git
graphviz
#hub
#imagemagick
jenv
#jq
#libjpeg
#libmemcached
#lynx
#markdown
#memcached
#mercurial
npm
#pkg-config
#postgresql
#python
python3
#pypy
#rabbitmq
rbenv
#rename
#ssh-copy-id
#terminal-notifier
#the_silver_searcher
#tmux
#tree
vim
wget
)
echo "Installing packages..."
brew install ${PACKAGES[@]}
echo "Cleaning up..."
brew cleanup
# echo "Installing cask..."
# brew install caskroom/cask/brew-cask
CASKS=(
alfred
box-sync
#colluquy
docker
dropbox
evernote
firefox
#flux
#google-chrome
#google-drive
#gpgtools
gpg-suite
intellij-idea
iterm2
macdown
#macvim
#skype
slack
#spectacle
sublime-text
tomighty
#vagrant
#virtualbox
#vlc
zulip
)
echo "Installing cask apps..."
brew install --cask ${CASKS[@]}
echo "Installing Java..."
brew tap adoptopenjdk/openjdk
brew install --cask adoptopenjdk13
#echo "Setting up jenv" - NOTE: I NEED TO MAKE THESE IDEMPOTENT SO FOR NOW YOU NEED TO RUN THEM MANUALLY
echo "Please look at the osx_bootstrap.sh and setup jenv manually."
#echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc
# grep -q -F 'eval "$(jenv init -)"' ~/.zshrc || echo 'eval "$(jenv init -)"' >> ~/.zshrc
# jenv add /Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home
echo "Mac App Store Apps - TBC"
# https://github.com/mas-cli/mas
# Trello
echo "Installing fonts via brew..."
#brew tap caskroom/fonts
#FONTS=(
# font-inconsolidata
# font-roboto
# font-clear-sans
#)
#brew cask install ${FONTS[@]}
#echo "Installing Powerline fonts..." - NOTE: I NEED TO MAKE THIS IDEMPOTENT SO FOR NOW YOU NEED TO RUN IT MANUALLY
echo "Please look at the osx_bootstrap.sh and setup Powerline Fonts (for oh-my-zsh) manually."
#git clone https://github.com/powerline/fonts.git --depth=1
#cd fonts
#./install.sh
#cd ..
#rm -rf fonts
#echo "Installing Python packages..."
#PYTHON_PACKAGES=(
#ipython
#virtualenv
#virtualenvwrapper
#)
#sudo pip install ${PYTHON_PACKAGES[@]}
echo "Installing Ruby gems"
RUBY_GEMS=(
bundler
#filewatcher
#cocoapods
)
sudo gem install ${RUBY_GEMS[@]}
echo "Installing global npm packages..."
npm install marked -g
# echo "Installing oh-my-zsh..." - NOTE: I NEED TO MAKE THIS IDEMPOTENT SO FOR NOW YOU NEED TO RUN IT MANUALLY
echo "Please look at the osx_bootstrap.sh and setup oh-my-zsh manually."
# sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
echo "Configuring OSX..."
# Set fast key repeat rate
defaults write NSGlobalDomain KeyRepeat -int 0
# Require password as soon as screensaver or sleep mode starts
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
# Show filename extensions by default
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Show hidden files in Finder
defaults write com.apple.Finder AppleShowAllFiles true
killall Finder
echo "Creating folder structure..."
[[ ! -d Workspaces ]] && mkdir Workspaces
[[ ! -d Workspaces/Clients ]] && mkdir Workspaces/Clients
[[ ! -d Workspaces/Personal ]] && mkdir Workspaces/Personal
[[ ! -d Workspaces/TW ]] && mkdir Workspaces/TW
echo "Bootstrapping complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment