Skip to content

Instantly share code, notes, and snippets.

@jousby
Last active November 24, 2021 04:29
Show Gist options
  • Save jousby/18950c84b21341d48c5c1710065ef96b to your computer and use it in GitHub Desktop.
Save jousby/18950c84b21341d48c5c1710065ef96b to your computer and use it in GitHub Desktop.
A macOS software install script updated for a Big Sur install (Aug 2021)
#!/bin/bash
#####################################################################
#
# A macOS software bootstrap script updated for a Big Sur
# install (08/2021).
#
# I have a seperate script that setups zsh and installs programming
# language toolchains that you would run after this if you are in
# software development game.
# Link to macos-devenv-bootstrap.sh:
# https://gist.github.com/jousby/2ab150ba190abf3cf7047f7f029e69d4
#
#
# NOTE: I had some intermittent download failures when installing
# some packages. This script is safe to re run multiple times until
# it succeeds.
#
# NOTE 2: You should check the script output manually for any failed
# installs. This script won't check overall success/failure.
#
# NOTE 3: The macOS settings at the end are fairly opinionated. If
# you don't understand what a setting will be changing you might
# want to delete it or comment it out.
#
#####################################################################
echo ""
echo "Starting bootstrapping"
echo ""
#####################################################################
# System update
#####################################################################
# Run outstanding system updates
echo "Running software update..."
softwareupdate -ia --verbose
echo ""
#####################################################################
# Xcode install
#####################################################################
# Install xcode cli development tools
echo "Installing xcode cli development tools..."
xcode-select --install
echo ""
#####################################################################
# Install brew apps
#####################################################################
# 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/HEAD/install.sh)"
echo ""
fi
# Update homebrew formula and casks
echo "Updating brew formula and casks..."
brew update
echo ""
echo "Installing brew formula..."
PACKAGES=(
ack # Grep for programmers
ghi # Convenience functions for git hub issues
gifsicle # Animated gifs
git # Version control
go # Golang tooling
graphviz # Graphs from structured files
hub # Convenience functions for github
jq # Command line Json parser
mas # Mac App Store CLI
pstree # ps output in tree format
reattach-to-user-namespace # Needed for clipboard integration with vim
tmux # Terminal multiplexer
tree # Recursive ls with indenting
virtualenv # Isolated python environments
wget # Retrieve web files
)
for pkg in "${PACKAGES[@]}"; do
brew install $pkg
echo ""
done
echo ""
echo "Installing brew casks..."
CASKS=(
alfred # Mac os helper
# amazon-workdocs-drive # Amazon workdocs client (was corrupted when i tried)
amazon-workspaces # Amazon workspaces client
anki # Flashcards, spaced repetition
bartender # Menubar manager
# camtasia # PAID, video editor
discord # Realtime chat
docker # Container tooling
duet # Use your ipad as a 2nd display
balenaetcher # Flash os images to SD cards (raspberry pis)
gimp # Graphics editor
google-chrome # Chrome web browser
intellij-idea-ce # JVM based IDE
iterm2 # A better terminal
joplin # Note taking app with markdown and vim support
# lilypond # Music engraving, sheet music (no big sur support yet)
mactex-no-gui # TeX typesetting (print math formula for anki flashcards)
nosql-workbench # GUI data modelling tool for DynamoDB
obs # Live streaming
pgadmin4 # Gui admin tool for postgres
postman # GUI for testing apis
selfcontrol # Block access to websites temporarily
skitch # Screenshot tool
skype # Video chat
slack # Realtime chat
spotify # Streaming music
twitch # Video streaming service
visual-studio-code # Electron based IDE
vlc # Media player
whatsize # Disk usaage utility
zoom # Video chat
)
for cask in "${CASKS[@]}"; do
brew install --cask $cask
done
echo ""
echo "Brew cleaning up..."
brew cleanup
echo ""
#####################################################################
# Install mac app store apps
#
# NOTE: The mas commands will only work if you are:
# - have downloaded the app from the store previously
# - are currently logged into the app store app
#####################################################################
echo "Installing mac app store apps..."
echo ""
mas install 1295203466 # Microsoft Remote Desktop, rdp into windows
mas install 1003160018 # Quip, doc collaboration
mas install 937984704 # Amphetamine, keep-awake utility
mas install 1056643111 # Clocker, menubar world clock
mas install 417375580 # BetterSnapTool, PAID, window organiser
#####################################################################
# Configure macOS
#####################################################################
echo ""
echo "Configure some macOS defaults..."
echo ""
# Set fast key repeat rate (if you find this to fast then original
# settings are 2 for the first setting, and 15 for the second).
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write NSGlobalDomain InitialKeyRepeat -int 13
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
# Show filename extensions by default
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Enable tap-to-click
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
# Disable "natural" scroll
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
# Setting trackpad & mouse speed to a reasonable number
defaults write -g com.apple.trackpad.scaling 2
defaults write -g com.apple.mouse.scaling 2.5
# Disabling the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Use column view in all Finder windows by default
defaults write com.apple.finder FXPreferredViewStyle Clmv
# Avoiding the creation of .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# Setting Dock to auto-hide and removing the auto-hiding delay"
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock autohide-delay -float 0
defaults write com.apple.dock autohide-time-modifier -float 0
# Disable annoying backswipe in Chrome
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false
# Setting screenshots location to ~/Desktop
defaults write com.apple.screencapture location -string "$HOME/Desktop"
# Setting screenshot format to PNG
defaults write com.apple.screencapture type -string "png"
# Setting the icon size of Dock items to 36 pixels for optimal size/screen-realestate
defaults write com.apple.dock tilesize -int 36
#####################################################################
# Done
#####################################################################
echo ""
echo ""
echo "****** Software bootstrapping finished! ******"
echo ""
echo " NOTE: You should check the output for failed installs."
echo " For issues like failed downloads you can safely try re running"
echo " this script until it succeeds."
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment