Skip to content

Instantly share code, notes, and snippets.

@mirhamasala
Last active May 12, 2024 17:35
Show Gist options
  • Save mirhamasala/277abfb5f7c6c5540af7ad4485f5a593 to your computer and use it in GitHub Desktop.
Save mirhamasala/277abfb5f7c6c5540af7ad4485f5a593 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Run without downloading:
# curl https://gist.githubusercontent.com/mirhamasala/277abfb5f7c6c5540af7ad4485f5a593/raw/.macos | bash
# Resources
# [Change macOS user preferences via command line](https://pawelgrzybek.com/change-macos-user-preferences-via-command-line/)
# [codeinthehole/osx_bootstrap.sh](https://gist.github.com/codeinthehole/26b37efa67041e1307db)
# [kentcdodds/dotfiles/macos](https://github.com/kentcdodds/dotfiles/blob/main/.macos)
# [lotharschulz/osx_bootstrap](https://gist.github.com/lotharschulz/304243b8050801f1e9d9af7748b04eb5)
# [macos-defaults.com](https://macos-defaults.com)
echo "🌱 Beginning setup..."
# Ask for administrator password upfront
sudo -v
# Keep-alive: Update existing `sudo` time stamp until `.macos` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
echo "🔨 Installing Xcode..."
xcode-select --install
# Install Homebrew if not installed
if test ! $(which brew); then
echo "🍺 Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
PACKAGES=(
gh
git
npm
node
thefuck
yarn
)
echo "📦 Installing packages..."
brew install ${PACKAGES[@]}
CASKS=(
appcleaner
firefox
freedom
google-chrome
grammarly
hey
imageoptim
kindle
lastpass
sip
skype
slack
spotify
surfshark
the-unarchiver
typora
visual-studio-code
workspaces
zoom
)
echo "🪵 Installing apps..."
brew install --cask ${CASKS[@]}
echo "🎨 Installing Oh My Zsh..."
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
echo "🧼 Cleaning up..."
brew cleanup
echo "✨ Brew update"
brew update
echo "🎩 Brew upgrade"
brew upgrade
echo "👩🏻‍⚕️ Brew doctor"
brew doctor
echo "🧹 Changing MacOS defaults - Note that some changes require a logout/restart to take effect"
# Dock > Set icon size to 36 pixels
defaults write com.apple.dock tilesize -int 36
# Dock > Magnification
defaults write com.apple.dock magnification -bool true
# Dock > Set -magnified- icon size to 54 pixels:
defaults write com.apple.dock largesize -int 54
# Dock > Minimize windows using scale effect
defaults write com.apple.dock mineffect -string "scale"
# Dock > Minimize windows into application icon
defaults write com.apple.dock minimize-to-application -bool true
# Dock > Autohide dock
defaults write com.apple.dock autohide -bool true
# Dock > Set autohide dock duration
defaults write com.apple.dock autohide-time-modifier -float 0.5
# Dock > Set autohide dock delay
defaults write com.apple.dock autohide-delay -float 0
# Dock > Show indicators for open applications
defaults write com.apple.dock show-process-indicators -bool true
# Dock > Remove all default app icons
defaults write com.apple.dock persistent-apps -array
# Finder > Keep folders on top when sorting by name
defaults write com.apple.finder _FXSortFoldersFirst -bool true
# Finder > View as List
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# Finder > Show Path Bar
defaults write com.apple.finder ShowPathbar -bool true
# Finder > Allow quitting via ⌘ + Q; Doing so will also hide desktop icons
defaults write com.apple.finder QuitMenuItem -bool true
# Finder > Disable warning before emptying the Trash
defaults write com.apple.finder WarnOnEmptyTrash -bool false
# Keyboard > Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 1
# Screen > Save screenshots to local Downloads folder
defaults write com.apple.screencapture location -string "${HOME}/Downloads"
# TextEdit > Set default document format to .txt
defaults write com.apple.TextEdit RichText -bool false
# Trackpad > Enable tap to click
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
# Kill affected applications
for app in "Activity Monitor" \
"cfprefsd" \
"Dock" \
"Finder" \
"SystemUIServer" \
"TextEdit"; do
killall "${app}" &> /dev/null
done
echo "🎉 Done!"
# @TODO Install
# [BetterSnapTool](https://apps.apple.com/us/app/bettersnaptool/id417375580)
# [Pixelmator Pro](https://apps.apple.com/us/app/pixelmator-pro/id1289583905)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment