Last active
April 1, 2024 16:53
-
-
Save samlester/5d4c75a37bbc7c2df302cf73a069a4ca to your computer and use it in GitHub Desktop.
Script to setup a new Mac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mac setup script | |
# By Sam Lester | |
# Originally based on https://gist.github.com/codeinthehole/26b37efa67041e1307db | |
# Usage: | |
# - Add email address and any additional apps to this file | |
# - Run sh ./mac-setup.sh | |
# - Run installers for apps that have them (Adobe Creative Cloud, Microsoft Office) | |
# - Install apps that aren't on cask (Magnet, Mactracker, iA Writer, Hand Mirror) | |
#!/bin/sh | |
NAME = "" | |
EMAIL = "" | |
# Ask for the administrator password upfront | |
sudo -v | |
# Install all available updates (if this requires a restart, run the script again) | |
sudo softwareupdate -ia --verbose | |
echo "Install installing Xcode command line tools..." | |
xcode-select --install | |
echo "Starting setup..." | |
# Check for Homebrew, install if we don't have it | |
if test ! $(which brew); then | |
echo "Installing homebrew..." | |
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
fi | |
echo "Installing Oh My Zsh..." | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
source ~/.zshrc | |
# Update homebrew recipes | |
brew update | |
echo "Installing packages..." | |
PACKAGES=( | |
composer | |
curl | |
dnsmasq | |
ffmpeg | |
git | |
imagemagick | |
nginx | |
php | |
vim | |
wget | |
) | |
brew install ${PACKAGES[@]} | |
echo "Configuring git..." | |
git config --global user.name $NAME | |
git config --global user.email $EMAIL | |
echo "Installing cask apps..." | |
brew tap homebrew/cask-versions | |
CASKS=( | |
adobe-creative-cloud | |
appcleaner | |
arc | |
brave-browser | |
brightness-sync | |
discord | |
dropbox | |
duckduckgo | |
elgato-control-center | |
epic-games | |
expressvpn | |
fantastical | |
figma | |
firefox | |
gifski | |
gog-galaxy | |
google-chrome | |
grandperspective | |
handbrake | |
harvest | |
imageoptim | |
istat-menus | |
iterm2 | |
linear-linear | |
logitech-options | |
loom | |
mamp | |
microsoft-edge | |
microsoft-remote-desktop | |
microsoft-teams | |
minecraft | |
namechanger | |
openemu | |
openrct2 | |
openttd | |
rotato | |
safari-technology-preview | |
slack | |
sony-ps-remote-play | |
spotify | |
steam | |
steamcmd | |
spline | |
sublime-text | |
tableplus | |
todoist | |
transmit | |
visual-studio-code | |
vlc | |
zoom | |
) | |
brew install --appdir="/Applications" --cask ${CASKS[@]} | |
echo "Installing fonts..." | |
brew tap homebrew/cask-fonts | |
FONTS=( | |
font-anonymous-pro | |
font-archivo | |
font-arvo | |
font-barlow | |
font-besley | |
font-bitter | |
font-bodoni-moda | |
font-bona-nova | |
font-cal-sans | |
font-chivo | |
font-cooper-hewitt | |
font-crimson-pro | |
font-crimson-text | |
font-dm-sans | |
font-el-messiri | |
font-fontawesome | |
font-handlee | |
font-hanken-grotesk | |
font-ibm-plex-mono | |
font-ibm-plex-sans | |
font-ibm-plex-serif | |
font-inconsolata | |
font-inter | |
font-iosevka | |
font-karla | |
font-la-belle-aurore | |
font-lato | |
font-libre-baskerville | |
font-libre-franklin | |
font-manrope | |
font-maple | |
font-merriweather | |
font-montserrat | |
font-noto-sans | |
font-noto-serif | |
font-nunito | |
font-open-sans | |
font-prompt | |
font-oswald | |
font-permanent-marker | |
font-playfair-display | |
font-pt-serif | |
font-public-sans | |
font-recursive | |
font-recursive-code | |
font-roboto | |
font-roboto-mono | |
font-roboto-slab | |
font-rubik | |
font-sarabun | |
font-sf-compact | |
font-sf-mono | |
font-sf-pro | |
font-sora | |
font-source-code-pro | |
font-source-sans-pro | |
font-source-serif-pro | |
font-space-grotesk | |
font-twitter-color-emoji | |
font-vollkorn | |
font-work-sans | |
) | |
brew install --cask ${FONTS[@]} | |
echo "Cleaning up..." | |
brew cleanup | |
echo "Installing RVM and configuring Ruby..." | |
echo "gem: --no-document" >> ~/.gemrc # Stop gems from installing documentation | |
curl -sSL https://get.rvm.io | bash -s stable --ruby | |
echo "Installing NVM and Node..." | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | |
source ~/.zshrc | |
nvm install node | |
nvm use node | |
echo "Installing global node packages..." | |
NODE_PACKAGES=( | |
mjml | |
yarn | |
) | |
npm install -g ${NODE_PACKAGES[@]} | |
echo "Creating Developer folder..." | |
[[ ! -d Developer ]] && mkdir Developer | |
echo "Generating new SSH keys..." | |
ssh-keygen -t ed25519 -C $EMAIL | |
echo "Configuring macOS..." | |
# Save to disk (not to iCloud) by default | |
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false | |
# Require password immediately after sleep or screen saver begins | |
defaults write com.apple.screensaver askForPassword -int 1 | |
defaults write com.apple.screensaver askForPasswordDelay -int 0 | |
# Save screenshots to Pictures/Screenshots | |
mkdir ~/Pictures/Screenshots | |
defaults write com.apple.screencapture location -string "~/Pictures/Screenshots" | |
# Show status bar in Finder | |
defaults write com.apple.finder ShowStatusBar -bool true | |
# Wipe all default app icons from the Dock | |
defaults write com.apple.dock persistent-apps -array | |
# Automatically hide and show the Dock | |
defaults write com.apple.dock autohide -bool true | |
# Set the icon size of Dock items to 64 pixels | |
defaults write com.apple.dock tilesize -int 64 | |
killall Dock | |
killall Finder | |
echo "Setup complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment