Skip to content

Instantly share code, notes, and snippets.

@spuder
Forked from markusand/Brewfile
Last active April 9, 2024 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spuder/e5f55f11cf4cbb4e4d175b34ff94e202 to your computer and use it in GitHub Desktop.
Save spuder/e5f55f11cf4cbb4e4d175b34ff94e202 to your computer and use it in GitHub Desktop.
macOS auto setup
Brewfile.lock.json

macOS clean setup

Customize macOS defaults and install software automatically.

Setup

Open macOS Terminal and run the following command

bash <(curl -s https://gist.githubusercontent.com/spuder/e5f55f11cf4cbb4e4d175b34ff94e202/raw/5ceeaa516a69911bffe40325a2514942e54912e1/install.sh)

Warning macOS user password and iCloud credentials will be prompted

🎉 That's it!

Updates

To update just the brew packages (without re-running all scripts)

make
make brew-bundle
make defaults

Customization

If the options in this configuration are not to your taste, fork this gist and customize as you prefer.

tap "homebrew/bundle"
brew "mas"
# App Store
# (If you haven't purchased these apps yet, you might get an error)
mas "Slack", id: 803453959
mas "The Unarchiver", id: 425424353
#mas "Spark", id: 1176895641
# mas "Dropover", id: 1355679052
#mas "Bitwarden", id: 1352778147
mas "Hand Mirror", id: 1502839586
mas "Velja", id: 1607635845
mas "Tailscale", id: 1475387142
mas "Microsoft TODO", id: 1274495053
mas "Things 3", id: 904280696
mas "Wireguard", id: 1451685025
mas "Hidden Bar", id: 1452453066
mas "Simplenote - Notes and Memos", id: 692867256
mas "TexSniper", id: 1528890965
mas "HEIC Converter", id: 1294126402
# mas "MyWallpaper", id: 1552826194
# mas "HEIC Converter", id: 1294126402
# HomeBrew CLI Tools
brew "coreutils"
brew "automake"
brew "watch"
brew "dos2unix"
brew "rename"
brew "s3cmd"
brew "colordiff"
brew "pwgen"
brew "pstree"
brew "asciinema"
brew "agg"
brew "trash"
brew "direnv"
brew "lolcat"
brew "azure-cli"
brew "awscli"
brew "mtr"
brew "pre-commit"
brew "mackup"
brew "handbrake"
brew "fswatch"
brew "go"
brew "pyenv-virtualenv"
brew "unison"
brew "autozimu/homebrew-formulas/unison-fsmonitor"
brew "pv"
brew "figlet"
brew "gh"
# tap "earthly/earthly"
# brew "earthly/earthly/earthly"
# tap "hashicorp/tap"
# brew "hashicorp/tap/boundary"
# brew "packer"
# brew "yamllint"
# brew "watch"
# brew "wget"
# brew "trash"
# brew "tree"
# Homebrew Graphical Applications
cask "rocket"
cask "grandperspective"
cask "rectangle"
cask "iina"
cask "shottr"
cask "onyx"
cask "appcleaner"
# cask "hiddenbar"
cask "notion"
cask "notion-calendar"
cask "obsidian"
cask "spotify"
#cask "around"
#cask "cloudmounter"
cask "raycast"
cask "imageoptim"
cask "tempbox"
cask "warp"
cask "1password"
cask "1password-cli"
cask "discord"
cask "aldente"
cask "utm"
cask "nvalt"
cask "prusaslicer"
cask "transmission"
cask "monitorcontrol"
cask "uhk-agent"
cask "displaylink"
cask "keyboardcleantool"
cask "stats"
cask "betterdisplay"
cask "flux"
cask "espanso"
cask "zoom"
cask "itsycal"
cask "balenaetcher"
#cask "upscayl"
# cask "MenubarX"
cask "bambu-studio"
cask "blender"
cask "audio-hijack"
cask "coolterm"
cask "easyeda"
cask "telegram"
cask "vlc"
cask "whatsapp"
cask "resilio-sync"
cask "raspberry-pi-imager"
cask "mu-editor"
cask "keybase"
cask "gpg-suite"
cask "platypus"
cask "karabiner-elements"
cask "iterm2"
# QUICKLOOK PLUGINS
# cask 'qlmarkdown'
# cask 'quicklook-json'
# cask 'quicklook-csv'
# cask 'qlstephen'
# cask 'qlimagesize'
# cask 'qlcolorcode'
# BROWSERS
cask "google-chrome"
# cask "firefox"
# cask "orion"
cask "brave-browser"
cask "mullvad-browser"
cask "min"
cask "arc"
cask "microsoft-edge"
# DEV TOOLS
brew "git"
cask "visual-studio-code"
brew "jq"
brew "yq"
cask "arduino-ide"
brew "git-lfs"
# Containers
cask "podman-desktop"
brew "podman-compose"
cask "orbstack"
# VSCode
vscode "redhat.ansible"
vscode "redhat.vscode-yaml"
vscode "tonybaloney.vscode-pets"
vscode "hashicorp.hcl"
vscode "hashicorp.terraform"
vscode "github.vscode-github-actions"
vscode "github.vscode-pull-request-github"
vscode "gitlab.gitlab-workflow"
vscode "github.copilot"
vscode "github.copilot-chat"
vscode "codeium.codeium"
vscode "eamodio.gitlens"
vscode "earthly.earthfile-syntax-highlighting"
vscode "ms-vscode-remote.remote-containers"
vscode "ms-vscode-remote.remote-ssh"
vscode "ms-vscode-remote.remote-wsl"
vscode "ms-vscode.cmake-tools"
vscode "ms-vscode.remote-explorer"
vscode "ms-vscode.remote-server"
vscode "platformio.platformio-ide"
#!/usr/bin/env bash
set -x
# Close any open System Preferences panes, to prevent them from overriding
# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the 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 &
# GENERAL :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Disable the sound effects on boot
sudo nvram SystemAudioVolume=" "
# Save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
# Disable the “Are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
# Use AirDrop over every interface
defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1
# Remove duplicates in the “Open With” menu (also see `lscleanup` alias)
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
# Disable automatic Smart Substitutions
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
# Disable auto-correct. OH YEAH PLEASE!
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# Set language and text formats
#defaults write NSGlobalDomain AppleLanguages -array "ca" "en" "es"
#defaults write NSGlobalDomain AppleLocale -string "es_ES@currency=EUR"
#defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters"
#defaults write NSGlobalDomain AppleMetricUnits -bool true
# Set the timezone
#sudo systemsetup -settimezone "Europe/Andorra" > /dev/null
# Hide language menu in the top right corner of the boot screen
#sudo defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool false
# TRACKPAD :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Enable tap to click for this user and for the login screen
#defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
#defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
#defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
# Enable 3-finger drag
#defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerDrag -bool true
#defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerDrag -bool true
# ENERGY SAVING ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Enable lid wakeup
#sudo pmset -a lidwake 1
# Sleep the display after 5 minutes
#sudo pmset -a displaysleep 5
# Disable machine sleep while charging
#sudo pmset -c sleep 0
# Set machine sleep to 10 minutes on battery
#sudo pmset -b sleep 10
# Disable hibernation
#sudo pmset -a hibernatemode 0
# FINDER :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Hide all icons and drives on desktop
defaults write com.apple.finder CreateDesktop -bool false
# Show icons for hard drives, servers, and removable media on the desktop
# defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
# defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
# defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
# defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
# Disable window animations
defaults write com.apple.finder DisableAllAnimations -bool true
# Disable warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Avoid creating .DS_Store files on network or USB volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
# Automatically open a new Finder window when a volume is mounted
defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true
# Disable warning when disk not ejected properly
# https://blog.adafruit.com/2021/05/11/how-to-tone-down-macos-big-surs-circuitpy-eject-notifications/
#defaults write com.apple.finder NSDisableEjectNotification -bool true
curl https://gist.githubusercontent.com/PaintYourDragon/a229f7c5f1992943a34ce1a5c7cb527c/raw/c12745c4cde36ac667b8ede16a8a707554f1072c/ejectfix.py >/tmp/ejectfix.py
python3 /tmp/ejectfix.py
# Set home as default location for new Finder windows
defaults write com.apple.finder NewWindowTarget -string "PfHm"
# Show status & path bar
defaults write com.apple.finder ShowStatusBar -bool true
defaults write com.apple.finder ShowPathbar -bool true
# Keep folders on top when sorting by name
defaults write com.apple.finder _FXSortFoldersFirst -bool true
# Search the current folder by default
defaults write com.apple.finder _FXSortFoldersFirst -bool true
# Set grid spacing for icons on the desktop and in other icon views
# spacing=64
# /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing $spacing" ~/Library/Preferences/com.apple.finder.plist
# /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing $spacing" ~/Library/Preferences/com.apple.finder.plist
# /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing $spacing" ~/Library/Preferences/com.apple.finder.plist
# # Set icons size on the desktop and in other icon views
# icon_size=48
# /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize $icon_size" ~/Library/Preferences/com.apple.finder.plist
# /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize $icon_size" ~/Library/Preferences/com.apple.finder.plist
# /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize $icon_size" ~/Library/Preferences/com.apple.finder.plist
# Use icon view in all Finder windows by default
# Four-letter codes for the other view modes: 'Nlsv', 'clmv', 'glyv'
defaults write com.apple.finder FXPreferredViewStyle -string "icnv"
# Show the ~/Library folder
chflags nohidden ~/Library
# DOCK ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Set the icon size of Dock items
defaults write com.apple.dock tilesize -int 64
# Minimize windows into their application’s icon
# defaults write com.apple.dock minimize-to-application -bool true
defaults write com.apple.dock minimize-to-application -bool false
# Wipe all default app icons from the Dock
defaults write com.apple.dock persistent-apps -array
# Don’t show recent applications in Dock
# defaults write com.apple.dock show-recents -bool false
# Autohide dock
defaults write com.apple.dock autohide -bool true
# NETWORK :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Set default Cloudflare DNS (and Google as fallback)
#networksetup -setdnsservers Wi-Fi 1.1.1.1 1.0.0.1 8.8.8.8
# TERMINAL :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Set default Terminal theme to Pro (dark)
#defaults write com.apple.terminal "Default Window Settings" -string "Pro"
#defaults write com.apple.terminal "Startup Window Settings" -string "Pro"
# KEYBOARD :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Speed up keyboard typing speed
defaults write 'Apple Global Domain' InitialKeyRepeat -int 25
defaults write 'Apple Global Domain' KeyRepeat -int 2
killall Dock
killall Finder
echo 'Set macOS defaults...'
bash <(curl -s https://gist.githubusercontent.com/spuder/e5f55f11cf4cbb4e4d175b34ff94e202/raw/5ceeaa516a69911bffe40325a2514942e54912e1/defaults.sh)
echo 'Install base macOS software'
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
brew analytics off
export HOMEBREW_NO_ANALYTICS=1
cd ~
curl https://gist.githubusercontent.com/spuder/e5f55f11cf4cbb4e4d175b34ff94e202/raw/5ceeaa516a69911bffe40325a2514942e54912e1/Brewfile -o Brewfile
brew bundle
rm Brewfile
echo 'Finished. Some changes require a restart to take effect.'
# Default target runs defaults.sh and then brew bundle
all: brew-bundle
# Target to run brew bundle
brew-bundle:
brew bundle
personal:
brew bundle --file Brewfile-personal
# Target to run ./defaults.sh
defaults:
./defaults.sh
# Generate mackup config file and backup existing ones
mackup:
# Check if ~/.mackup.cfg exists and back it up if it does
if [ -f ~/.mackup.cfg ]; then \
mv ~/.mackup.cfg ~/.mackup.cfg.backup.$$(date +%Y-%m-%d); \
fi
# Ensure the ~/.mackup directory exists
mkdir -p ~/.mackup
# Copy the main mackup config file
cp mackup/.mackup.cfg ~/.mackup.cfg
# Loop through all .cfg files in the mackup directory
for file in mackup/*.cfg; do \
if [ -f "$$file" ]; then \
filename=$$(basename $$file); \
cp $$file ~/.mackup/; \
fi; \
done
.PHONY: all brew-bundle defaults mackup
Show home folder in side bar of finder
Show mac hard drive in side bar of finder
Disable automaticlaly reopening all application
Disable 3 key press for dictionary definition
Change setting for monitor going black
Choose between monitorcontrol and betterdisplay
Disable copy paste between imacs
Disable notes in bottom right corner on Sonoma
Default password manager
Chome disable Secure DNS
# Mackup
- muteme
- aldente
- resillio (exclude)
- textsniper
- anyconnect (/opt/cisco/anyconnect/profile)
- secureID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment