Last active
October 24, 2023 00:01
-
-
Save derrickshowers/ee93b17cc6cba4c46b9aef5e722c4102 to your computer and use it in GitHub Desktop.
Setup script for macOS.
This file contains 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
#!/bin/bash | |
# Update me! | |
COMPUTER_NAME="Airfred" | |
COMPUTER_NETWORK_NAME="Airfred" | |
# Setup script for macOS. | |
# Download. Update variables above. Run `chmod 755 ./macos-setup.sh && ./macos-setup.sh`. | |
# Adapted from: https://gist.github.com/AlexanderSix/c0ac2d87abd205b9a9c9cdb8502c2f4e | |
# Also adapted from: https://gist.github.com/bradp/bea76b16d3325f5c47d4 | |
# Help in writing script: https://devhints.io/bash | |
# Brew Packages List | |
UTILITIES=( | |
raycast | |
cleanmymac | |
dropbox | |
fork | |
ffmpeg | |
wget | |
xcodes | |
) | |
COMMUNICATION=( | |
slack | |
zoom | |
) | |
EDITORS=( | |
visual-studio-code | |
) | |
LANGUAGES=( | |
rbenv | |
) | |
BROWSERS=( | |
google-chrome | |
) | |
GRAPHICS=( | |
figma | |
) | |
NOTE_TAKING=( | |
notion | |
) | |
PASSWORD_MANAGERS=( | |
1password | |
) | |
echo "This script installs a number of default macOS packages and programs." | |
echo "Before running, make sure you have removed any packages that you do not want from the script" | |
echo | |
read -p "Are you sure you would like to proceed with the install? [y/N]: " -r | |
echo | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
echo "macOS setup in progress!" | |
else | |
return 1; | |
fi | |
echo "Installing Xcode Tools" | |
xcode-select --install | |
sudo softwareupdate --install-rosetta | |
echo "Installing Homebrew" | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
eval "$(/opt/homebrew/bin/brew shellenv)" | |
brew update | |
# @TODO should `--cask` be included for some of these? | |
brew install ${UTILITIES[@]} | |
brew install ${COMMUNICATION[@]} | |
brew install ${EDITORS[@]} | |
brew install ${LANGUAGES[@]} | |
brew install ${BROWSERS[@]} | |
brew install ${GRAPHICS[@]} | |
brew install ${NOTE_TAKING[@]} | |
brew install ${PASSWORD_MANAGERS[@]} | |
brew cleanup | |
echo | |
echo "Installing Oh My Zsh" | |
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
echo | |
echo "Naming computer $COMPUTER_NAME" | |
scutil --set ComputerName $COMPUTER_NAME | |
scutil --set LocalHostName $COMPUTER_NETWORK_NAME | |
echo | |
echo "Saving sensible macOS defaults" | |
# Automatically quit the printer app once print jobs are finished | |
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true | |
# Finder: When performing a search, search current folder by default | |
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" | |
# Use column view in all Finder windows by default | |
defaults write com.apple.finder FXPreferredViewStyle -string "Clmv" | |
# Enable snap-to-grid for Finder and Desktop | |
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist | |
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist | |
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist | |
# Other Desktop view settings | |
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 32" ~/Library/Preferences/com.apple.finder.plist | |
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist | |
# Don’t automatically rearrange Spaces based on most recent use | |
defaults write com.apple.dock mru-spaces -bool false | |
# Configure Dock | |
defaults delete com.apple.dock persistent-apps | |
defaults write com.apple.dock magnification -bool true | |
defaults write com.apple.dock show-process-indicators -bool false | |
defaults write com.apple.dock show-recents -bool false | |
defaults write com.apple.dock tilesize -int 40 | |
defaults write com.apple.dock largesize -int 60 | |
# Terminal | |
defaults write com.apple.Terminal "Startup Window Settings" -string "Pro" | |
defaults write com.apple.Terminal "Default Window Settings" -string "Pro" | |
# Xcode | |
defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES | |
echo | |
echo "Restart Finder and Dock" | |
killall Dock | |
killall Finder | |
# Developer | |
echo | |
echo "Setting up Developer-y things" | |
mkdir -p ~/Developer | |
git config --global user.name "Derrick Showers" | |
git config --global user.email "[email protected]" | |
# Manual Setup | |
echo | |
echo "Finished automated setup. Now comes the manual part." | |
echo | |
echo "++++++++++++++++++" | |
echo "Login to 1Password" | |
echo "++++++++++++++++++" | |
echo "Opening 1Password..." | |
open -a "1Password 7" | |
read -p "Press [return] to continue." | |
echo | |
echo | |
echo "++++++++++++++++" | |
echo "Login to Dropbox" | |
echo "++++++++++++++++" | |
echo "In preferences, go to \"Sync -> Select Folders\" Choose only the \"sync\" directory." | |
echo "Also remove from sidebar in Finder." | |
read -p "Press [return] once Dropbox has finished syncing." | |
echo | |
echo | |
echo "+++++++++++++++" | |
echo "Login to iCloud" | |
echo "+++++++++++++++" | |
echo "Opening iCloud Preferences..." | |
open -b com.apple.systempreferences /System/Library/PreferencePanes/AppleIDPrefPane.prefPane | |
read -p "Press [return] to continue." | |
echo | |
echo | |
echo "+++++++++++++++" | |
echo "Login to Google" | |
echo "+++++++++++++++" | |
echo "Add contacts and calendars for Google. Turn off iCloud calendars and contacts." | |
echo "Opening Internet Accounts Preferences..." | |
open -b com.apple.systempreferences /System/Library/PreferencePanes/InternetAccounts.prefPane | |
read -p "Press [return] to continue." | |
echo | |
echo | |
echo "++++++++++++++++++++++" | |
echo "Install App Store apps" | |
echo "++++++++++++++++++++++" | |
echo "Opening App Store..." | |
open -a "App Store" | |
read -p "Install Day One. Press [return] to continue." | |
echo | |
# Dotfiles | |
echo | |
echo "Syncing dotfiles from Dropbox" | |
# @TODO maybe it doesn't make sense to sync zshrc? things get installed and added, to hard to keep everything in sync. | |
if [[ -d ~/Dropbox/Sync/Dotfiles ]] | |
then | |
rm ~/.vimrc | |
ln -s ~/Dropbox/Sync/Dotfiles/vimrc ~/.vimrc | |
rm ~/.zshrc | |
ln -s ~/Dropbox/Sync/Dotfiles/zshrc ~/.zshrc | |
else | |
echo "Are you sure Dropbox has finished syncing?" | |
read -p "Double check and press [return] to try again." | |
rm ~/.vimrc | |
ln -s ~/Dropbox/Sync/Dotfiles/vimrc ~/.vimrc | |
rm ~/.zshrc | |
ln -s ~/Dropbox/Sync/Dotfiles/zshrc ~/.zshrc | |
fi | |
# Finished! | |
echo | |
echo "Finished setup. Note that some of these changes require a restart." | |
read -p "Would you like to restart now? [y/N]: " -r | |
echo | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
echo "Your setup is complete." | |
sudo shutdown -r now | |
echo "Restarting now!" | |
fi | |
echo "Your setup is complete. Please restart your machine when possible." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment