macOS Setup

Backup Files (just in case)

Save the following file locations to an external drive:

Automated

Before you do anything, enable iCloud Desktop and Documents syncing

Before running the script, have a look at https://github.com/tillstuder/config and copy the dotfiles from there to ~

macOS Settings

echo "# Boot Settings"
echo "Enabling verbose boot mode"
sudo nvram boot-args="-v"

echo "Disable Sound Effects"
sudo nvram StartupMute=%01

echo "# Security Settings"
echo "Enabling Firewall"
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on

echo "Enable Gatekeeper"
sudo spctl --master-enable

echo "Require password after screen saver begins or display is turned of immediately"
sudo osascript -e 'tell application "System Events" to set require password to wake of security preferences to true'

echo "# Sleep Settings"
echo "Put Display to Sleep after 15 Minutes of Inactivity"
sudo pmset displaysleep 15

echo "Put Computer to Sleep after 30 Minutes of Inactivity"
sudo pmset sleep 30


echo "# Dock Settings"
echo "Setting Position"
defaults write com.apple.dock "orientation" -string "bottom"

echo "Setting Size"
defaults write com.apple.dock "tilesize" -int "56"

echo "Enabling Auto Hide"
defaults write com.apple.dock "autohide" -bool "true"

echo "Faster Show/Hide Animation"
defaults write com.apple.dock autohide-time-modifier -float 0.15

echo "Faster Delay"
defaults write com.apple.dock "autohide-delay" -float "0"

echo "Disable Show Recents"
defaults write com.apple.dock "show-recents" -bool "false"

echo "Enable dragging a file over an icon to open app"
defaults write com.apple.dock "enable-spring-load-actions-on-all-items" -bool "true"

killall Dock


echo "# Safari Settings"
echo "Enable Show Full URL"
defaults write com.apple.safari "ShowFullURLInSmartSearchField" -bool "true"

echo "Disable sending search queries to Apple"
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true

echo "Enable the Developer menu and the Web Inspector"
defaults write com.apple.Safari IncludeDevelopMenu -bool true
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true

echo "Warn about fraudulent websites"
defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true

echo "Enable Send DoNotTrack Header"
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true

echo "Update extensions automaticall"
defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true

killall Safari


echo "# Finder Settings"
echo "Show extensions"
defaults write NSGlobalDomain "AppleShowAllExtensions" -bool "true"

echo "Show Hidden Files"
defaults write com.apple.finder "AppleShowAllFiles" -bool "true"

echo "Show Path Bar"
defaults write com.apple.finder "ShowPathbar" -bool "true"

echo "Show Status Bar"
defaults write com.apple.finder ShowStatusBar -bool "true"

echo "Default to List View"
defaults write com.apple.finder "FXPreferredViewStyle" -string "Nlsv"

echo "Show Folders first"
defaults write com.apple.finder "_FXSortFoldersFirst" -bool "true"

echo "Setting default search scope to current folder"
defaults write com.apple.finder "FXDefaultSearchScope" -string "SCcf"

echo "Disable Auto Emptying of Bin"
defaults write com.apple.finder "FXRemoveOldTrashItems" -bool "false"

echo "Set Default Finder Location to Home Folder"
defaults write com.apple.finder NewWindowTarget -string "PfLo" && \
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}"

killall Finder


echo "# Menu Bar Settings"
echo "Setting Digital Clock Format"
defaults write com.apple.menuextra.clock "DateFormat" -string "\"HH:mm:ss\""

killall SystemUIServer


echo "# TextEdit Settings"
echo "Open new document by default"
defaults write com.apple.TextEdit NSShowAppCentricOpenPanelInsteadOfUntitledFile -bool false

echo "Use plain text mode for new documents"
defaults write com.apple.TextEdit RichText -int 0

echo "Open and save files as UTF-8"
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4

killall TextEdit


echo "Mac App Store Settings"
echo "Enable the automatic update check"
defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true

echo "Check for software updates daily, not just once per week"
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1

echo "Download newly available updates in background"
defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1

echo "Install System data files & security updates"
defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1

echo "Turn on app auto-update"
defaults write com.apple.commerce AutoUpdate -bool true


echo "# Typing Settings"
echo "Disable automatic capitalization"
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false

echo "Disable smart dashes"
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false

echo "Disable automatic period substitution"
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false

echo "Disable smart quotes"
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false

echo "Disable auto-correct"
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false


echo "# Trackpad Settings"
echo "Enable tap to click"
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

[1] [2] [3]

Setting up the package manager

echo "Installing xcode as a prerequisite for brew"
sudo xcode-select --install

echo "Installing brew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

echo "Verify the brew installation is healthy"
brew doctor

Installing and configuring ZSH

echo "Installing Z Shell and Oh My Zsh"
brew install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
chsh -s $(which zsh)
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
source ~/.zshrc

echo "Setting up powerlevel10k"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
p10k configure
source ~/.zshrc

Installing all other software

echo "Installing the CLI tools"
brew install \
    mas \
    tree \
    wget \
    nmap \
    ffuf \
    vim \
    tmux \
    ripgrep \
    rga \
    fzf \
    ffmpeg \
    pandoc \
    poppler \
    tesseract \
    pyenv \
    git

echo "Installing security related tools"
brew install --cask \
    knockknock \
    taskexplorer \
    reikey \
    blockblock \
    little-snitch \
    ransomwhere \
    oversight \
    dhs \
    whatsyoursign \
    lockdown

echo "Installing utilities and productivity tools"
brew install --cask \
    iterm2 \
    appcleaner \
    the-unarchiver \
    downie \
    keepingyouawake \
    cheatsheet \
    rectangle \
    betterdisplay \
    bartender \
    shottr \
    alt-tab \
    flux \
    onyx \
    notunes \
    tor-browser \
    tyke \
    balenaetcher \
    adguard \
    wireshark \
    crystalfetch \
    logi-options+ \
    utm \
    calibre \
    languagetool \
    transmission

echo "Installing the default apps"
brew install --cask \
    firefox \
    google-chrome \
    microsoft-edge \
    deepl \
    spotify \
    bluos-controller \
    1password \
    zotero \
    obsidian \
    anki \
    visual-studio-code \
    ableton-live-suite \
    discord \
    ollama \
    anythingllm \
    whatsapp

echo "Installing Quick Look plugins"
brew install --cask \
    qlcolorcode \
    qlstephen \
    qlmarkdown \
    quicklook-json
sudo xattr -cr ~/Library/QuickLook/*.qlgenerator
qlmanage -r
qlmanage -r cache

echo "Installing the Mac App Store apps"
mas install 904280696 # Things
mas install 1529448980 # Reeder
mas install 1568924476 # Mela
mas install 1534275760 # LanguageTool
mas install 1569813296 # 1Password for Safari
mas install 1438243180 # Dark Reader for Safari
mas install 1591303229 # Vinegar
mas install 1573461917 # SponsorBlock
mas install 1637438059 # UnTrap
mas install 1160374471 # PiPifier
mas install 1606897889 # Consent-O-Matic
mas install 1611378436 # Pure Paste
mas install 1475387142 # Tailscale

Manual

The following apps can't be automatically installed, these you will have to install manually:

Now that all apps are installed, some preferences inside them need to be adapted:


Relevant Note(s): Windows Setup


  1. https://macos-defaults.com/ ↩︎

  2. https://github.com/mathiasbynens/dotfiles/blob/main/.macos ↩︎

  3. https://git.herrbischoff.com/awesome-macos-command-line/about/ ↩︎