Created
December 18, 2023 13:36
-
-
Save dagstuan/4e56ae7c87aeafbb43dc8f4b984af91c to your computer and use it in GitHub Desktop.
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
tap "homebrew/bundle" | |
tap "homebrew/cask" | |
tap "homebrew/core" | |
tap "homebrew/services" | |
brew "zsh" | |
brew "git" | |
brew "stow" | |
brew "z" | |
brew "tmux" | |
brew "sleepwatcher", restart_service: true | |
brew "mas" | |
cask "google-chrome" | |
cask "spotify" | |
cask "transmission" | |
cask "iina" | |
cask "handbrake" | |
cask "visual-studio-code" | |
cask "slack" | |
cask "arq" | |
cask "1password" | |
cask "1password-cli" | |
cask "iterm2" | |
cask "monitorcontrol" | |
# Menu bar | |
cask "bartender" | |
cask "macs-fan-control" | |
cask "monitorcontrol" | |
cask "bettertouchtool" | |
mas "AdGuard for Safari", id: 1440147259 | |
mas "Xcode", id: 497799835 | |
mas "Amphetamine", id: 937984704 | |
mas "Wireguard", id: 1451685025 |
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
# IMPORTANT: | |
# Enable full disk access for terminal app before running this script. | |
# | |
#!/bin/sh | |
sudo -v | |
################################################################################## | |
# osx settings from https://github.com/mathiasbynens/dotfiles/blob/master/.macos # | |
################################################################################## | |
osascript -e 'tell application "System Preferences" to quit' | |
# Set symbolic hotkeys such as cmd+< to move to next window | |
# https://stackoverflow.com/questions/34561758/is-there-a-way-to-change-keyboard-shortcuts-with-shell-in-os-x | |
defaults import com.apple.symbolichotkeys symbolichotkeys.plist | |
# Keyboard repeat settings | |
defaults write -g InitialKeyRepeat -int 35 | |
defaults write -g KeyRepeat -int 2 | |
# 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 | |
# 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 | |
# Disable “natural” (Lion-style) scrolling | |
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false | |
# Increase sound quality for Bluetooth headphones/headsets | |
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 | |
# Enable full keyboard access for all controls | |
# (e.g. enable Tab in modal dialogs) | |
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 | |
# Set language and text formats | |
# Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with | |
# `Inches`, `en_GB` with `en_US`, and `true` with `false`. | |
defaults write NSGlobalDomain AppleLanguages -array "en-NO" | |
defaults write NSGlobalDomain AppleLocale -string "en_NO" | |
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" | |
defaults write NSGlobalDomain AppleMetricUnits -bool true | |
sudo systemsetup -settimezone "Europe/Oslo" > /dev/null | |
defaults write com.apple.mail FullScreenPreferSplit 0 | |
# Better settings for bluetooth audio | |
# sudo defaults write bluetoothaudiod "Enable AptX codec" -bool false | |
# sudo defaults write bluetoothaudiod "Enable AAC codec" -bool true | |
# sudo defaults write bluetoothaudiod "AAC Bitrate" -int 320 | |
# sudo defaults write bluetoothaudiod "Apple Bitpool Max" -int 64 | |
# sudo defaults write bluetoothaudiod "Apple Bitpool Min" -int 60 | |
# sudo defaults write bluetoothaudiod "Apple Initial Bitpool" -int 64 | |
# sudo defaults write bluetoothaudiod "Disable HFP" -bool false | |
# Enable tap-to-click for touchpad | |
defaults -currentHost write -globalDomain com.apple.mouse.tapBehavior -int 1 | |
############################################################################### | |
# Energy saving # | |
############################################################################### | |
# Set machine sleep to 5 minutes on battery | |
sudo pmset -b sleep 1 | |
# Disable machine sleep while charging | |
sudo pmset -c sleep 0 | |
############################################################################### | |
# Finder # | |
############################################################################### | |
# 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 | |
# Finder: show all filename extensions | |
defaults write NSGlobalDomain AppleShowAllExtensions -bool true | |
# Finder: show status bar | |
defaults write com.apple.finder ShowStatusBar -bool true | |
# Finder: show path bar | |
defaults write com.apple.finder ShowPathbar -bool true | |
# Disable the warning when changing a file extension | |
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false | |
# Use list view in all Finder windows by default | |
# Four-letter codes for the other view modes: `icnv`, `clmv`, `glyv` | |
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" | |
# Disable the warning before emptying the Trash | |
defaults write com.apple.finder WarnOnEmptyTrash -bool false | |
# Show the ~/Library folder | |
if [[ $(xattr -l ~/Library | grep com.apple.FinderInfo) == "" ]] | |
then | |
: | |
else | |
xattr -d com.apple.FinderInfo ~/Library | |
fi | |
chflags nohidden ~/Library | |
# Show the /Volumes folder | |
sudo chflags nohidden /Volumes | |
############################################################################### | |
# Dock, Dashboard, and hot corners # | |
############################################################################### | |
# Show indicator lights for open applications in the Dock | |
defaults write com.apple.dock show-process-indicators -bool true | |
# Hot corners | |
# Possible values: | |
# 0: no-op | |
# 2: Mission Control | |
# 3: Show application windows | |
# 4: Desktop | |
# 5: Start screen saver | |
# 6: Disable screen saver | |
# 7: Dashboard | |
# 10: Put display to sleep | |
# 11: Launchpad | |
# 12: Notification Center | |
# 13: Lock Screen | |
# Top right screen corner → Mission Control | |
defaults write com.apple.dock wvous-tr-corner -int 2 | |
defaults write com.apple.dock wvous-tr-modifier -int 0 | |
# Bottom right screen corner → Desktop | |
defaults write com.apple.dock wvous-br-corner -int 4 | |
defaults write com.apple.dock wvous-br-modifier -int 0 | |
defaults write com.apple.dock expose-group-apps -bool true | |
# Enable spring loading for all Dock items | |
defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true | |
# Set the icon size of Dock items to 58 pixels | |
defaults write com.apple.dock tilesize -int 58 | |
# Remove the auto-hiding Dock delay | |
defaults write com.apple.dock autohide-delay -float 0.2 | |
# Automatically hide and show the Dock | |
defaults write com.apple.dock autohide -bool true | |
# Don’t show recent applications in Dock | |
defaults write com.apple.dock show-recents -bool false | |
############################################################################### | |
# Safari & WebKit # | |
############################################################################### | |
# Privacy: don’t send search queries to Apple | |
defaults write com.apple.Safari UniversalSearchEnabled -bool false | |
defaults write com.apple.Safari SuppressSearchSuggestions -bool true | |
# Enable the Develop menu and the Web Inspector in Safari | |
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 | |
############################################################################### | |
# Terminal & iTerm 2 # | |
############################################################################### | |
defaults write com.apple.Terminal "Default Window Settings" -string "Pro" | |
defaults write com.apple.Terminal "Startup Window Settings" -string "Pro" | |
# Only use UTF-8 in Terminal.app | |
defaults write com.apple.terminal StringEncodings -array 4 | |
############################################################################### | |
# Photos # | |
############################################################################### | |
# Prevent Photos from opening automatically when devices are plugged in | |
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true | |
############################################################################### | |
# Homebrew # | |
############################################################################### | |
which -s brew | |
if [[ $? != 0 ]] ; then | |
# Install Homebrew | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile | |
eval "$(/opt/homebrew/bin/brew shellenv)" | |
else | |
brew update | |
fi | |
brew bundle | |
brew services start sleepwatcher | |
############################################################################### | |
# Stow # | |
############################################################################### | |
pushd stow | |
# Files omitted due to secrets | |
stow --verbose -t ~/ --restow git sleepwatcher ssh tmux zsh | |
popd | |
############################################################################### | |
# Kill affected applications # | |
############################################################################### | |
for app in "cfprefsd" \ | |
"Dock" \ | |
"Finder" \ | |
"SystemUIServer"; do | |
killall "${app}" &> /dev/null | |
done | |
echo "Done. Note that some of these changes require a logout/restart to take effect." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment