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:
# - You'll need to install the Xcode command line tools for things like Rust to
# work. (See https://www.studytonight.com/post/solved-mac-os-xcrun-error-invalid-active-developer-path-missing-xcrun
# for more info.) To install run:
#
# xcode-select --install
#
# - 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"
echo "(Make sure you've done the pre-requisites in the comment at the top of this script.)"
# Check for Homebrew, install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
/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=(
git
graphviz
keybase
libressl
npm
python3
rbenv
vim
wget
)
echo "Installing packages..."
brew install ${PACKAGES[@]}
echo "Cleaning up..."
brew cleanup
CASKS=(
alfred
box-sync
docker
evernote
firefox
gpg-suite
intellij-idea
iterm2
macdown
slack
sublime-text
tomighty
visual-studio-code
zulip
)
echo "Installing cask apps..."
brew install --cask ${CASKS[@]}
echo "Mac App Store Apps - TBC"
# https://github.com/mas-cli/mas
# Trello
#echo "Installing fonts..."
#brew tap caskroom/fonts
#FONTS=(
# font-clear-sans
#)
#brew cask install ${FONTS[@]}
#echo "Installing Python packages..."
#PYTHON_PACKAGES=(
#ipython
#)
#sudo pip install ${PYTHON_PACKAGES[@]}
echo "Installing Ruby gems"
RUBY_GEMS=(
bundler
)
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 "Install various Java versions"
sh -c ./brew_install_java.sh
# If rustc isn't available, install Rust via (Rustup)
if ! $(which rustc); then
echo "Installing Rust..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
fi
# If ponyc isn't available, install Ponyup
#if ! $(which ponyc); then
# echo "Installing Pony..."
# sh -c "$(curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/ponylang/ponyup/latest-release/ponyup-init.sh)"
# NOTE: Need to add the ponylang binary dir to $PATH here - I'm writing path-updater in rust to do this...
# ponyup update ponyc release
# ponyup update corral release
#fi
echo "Configuring OSX..."
# 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