Skip to content

Instantly share code, notes, and snippets.

@devotox
Forked from codeinthehole/osx_bootstrap.sh
Last active June 2, 2020 19:58
Show Gist options
  • Save devotox/4faaeee2c228aba8c01d320f1661439a to your computer and use it in GitHub Desktop.
Save devotox/4faaeee2c228aba8c01d320f1661439a 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:
#
# 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"
echo "Setting up Bash Profile"
touch ~/.zshrc
touch ~/.bash_profile
echo export EDITOR=nano > ~/.bash_profile
echo export VISUAL=nano >> ~/.bash_profile
echo export PATH="/usr/local/opt/ruby/bin:$PATH" >> ~/.bash_profile
source ~/.bash_profile
cat ~/.bash_profile
# Check for Homebrew, install if we don't have it or update if we do
if test ! $(which brew); then
echo "Installing Homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
echo "Updating Homebrew..."
brew update
fi
HOMEBREW_NO_AUTO_UPDATE=1
# Install GNU core utilities (those that come with OS X are outdated)
brew install coreutils
brew install grep
brew install gnu-sed
brew install gnu-tar
brew install gnu-indent
brew install gnu-which
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
brew install findutils
# Install Bash 4
brew install bash
echo "Installing Brew Packages..."
BREW=(
ack
autoconf
automake
docker
ffmpeg
fish
fluxctl
gettext
gifsicle
git
github/gh/gh
graphviz
go
hub
imagemagick
jq
libjpeg
libmemcached
lynx
markdown
memcached
trash
pkg-config
postgresql
python
python3
pypy
rabbitmq
rename
ruby
rust
starship
ssh-copy-id
terminal-notifier
the_silver_searcher
tmux
tree
wget
)
brew install ${BREW[@]} --force
echo "Installing Brew Cask Apps..."
CASKS=(
1password
alfred
android-ndk
android-sdk
authy
bettertouchtool
dropbox
google-backup-and-sync
google-chrome
rambox
resolutionator
slack
spectacle
sublime-text
visual-studio-code
vlc
)
brew cask install ${CASKS[@]} --force
echo "Installing Fonts..."
FONTS=(
font-roboto
font-clear-sans
)
brew tap homebrew/cask-fonts
brew cask install ${FONTS[@]} --force
echo "Installing Python Packages..."
PYTHON_PACKAGES=(
ipython
virtualenv
virtualenvwrapper
)
sudo easy_install pip
sudo pip install ${PYTHON_PACKAGES[@]}
echo "Installing Ruby Gems..."
RUBY_GEMS=(
bundler
cocoapods
colorls
filewatcher
json
)
gem install ${RUBY_GEMS[@]}
mkdir -p ~/.config/colorls
source $(dirname $(sudo gem which colorls))/tab_complete.sh
cp $(dirname $(sudo gem which colorls))/yaml/dark_colors.yaml ~/.config/colorls/dark_colors.yaml
echo "Installing Volta..."
curl https://get.volta.sh | bash
echo "Installing NPM Packages..."
NPM_PACKAGES=(
node
node@10
ember-cli
npm-check-updates
release-it
spaceship-prompt
yarn
)
volta install ${NPM_PACKAGES[@]}
echo "Setup Hyper..."
curl -k https://gist.githubusercontent.com/robertcoopercode/031b14a04697413094ea48a725748466/raw/0f91e7a8e8e926406f6a6a51b51dbdcef6795728/dark_colors.yaml > ~/.config/colorls/dark_colors.yaml
echo "Configuring Shell..."
curl -L https://get.oh-my.fish | fish
sudo echo /usr/local/bin/fish | sudo tee -a /etc/shells
sudo chsh -s /usr/local/bin/fish
chsh -s /usr/local/bin/fish
echo "$SHELL"
echo "Setup SSH..."
chmod u=rw,go= ~/.ssh/id_rsa ~/.ssh/id_rsa.pub
ssh-add ~/.ssh/id_rsa
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
# Enable tap-to-click
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
# Disable "natural" scroll
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
# Disable DS_Store
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
echo "Cleaning up..."
brew cleanup
echo "Bootstrapping complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment