First commit with mac bootstrapping stuff

This commit is contained in:
Christian Baer 2020-05-20 00:56:40 +02:00
parent 28c5ca1eff
commit 12d2f7a2ac
2 changed files with 274 additions and 0 deletions

120
init/Brewfile Normal file
View File

@ -0,0 +1,120 @@
cask_args appdir: '/Applications'
ALL_FFMPEG_OPTIONS = `brew options ffmpeg | grep -vE '\s' | grep -- '--with-'`.gsub("--", "").split("\n")
tap "caskroom/cask"
tap "caskroom/fonts"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-drivers"
tap "homebrew/core"
brew "brew-cask-completion"
brew "checkbashisms"
brew "coreutils"
brew "exiftool"
brew "ffmpeg", args: ALL_FFMPEG_OPTIONS
brew "git"
brew "grep"
brew "htop"
brew "hugo"
brew "iperf"
brew "iperf3"
brew "mas"
brew "mosh"
brew "node"
brew "nativefier"
brew "nmap"
brew "rsync"
brew "tmux"
brew "tree"
brew "vim"
brew "youtube-dl"
brew "zsh"
brew "zsh-completions"
cask "alfred"
cask "amethyst"
cask "atom"
cask "balenaetcher"
cask "bartender"
cask "bonjeff"
cask "calibre"
cask "carbon-copy-cloner"
cask "chromium"
cask "coconutbattery"
cask "db-browser-for-sqlite"
cask "dbeaver-community"
cask "diskmaker-x"
cask "evolv-escribe-suite"
cask "fantastical"
cask "firefox"
cask "fluid"
cask "fog"
cask "font-courier-prime"
cask "font-courier-prime-code"
cask "font-courier-prime-medium-and-semi-bold"
cask "font-courier-prime-sans"
cask "fork"
cask "github"
cask "handbrake"
cask "hazel"
cask "istat-menus"
cask "iterm2"
cask "java"
cask "jdownloader"
cask "libreoffice"
cask "little-snitch"
cask "marked"
cask "mediathekview"
cask "moneymoney"
cask "nextcloud"
cask "onyx"
cask "pdf-expert"
cask "portfolioperformance"
cask "qlcommonmark"
cask "ramme"
cask "sequel-pro"
cask "shifty"
cask "sloth"
cask "sonos"
cask "spotify"
cask "thunderbird"
cask "transmission"
cask "transmit"
cask "tuxera-ntfs"
cask "typora"
cask "virtualbox"
cask "vlc"
cask "wireshark"
mas "Affinity Designer", id: 824171161
mas "Affinity Publisher", id: 881418622
mas "Amphetamine", id: 937984704
mas "AudioBookBinder", id: 413969927
mas "Banking 4X", id: 926711151
mas "Bitwarden", id: 1352778147
mas "Cardhop", id: 1290358394
mas "Color Picker", id: 641027709
mas "Create Booklet", id: 943029046
mas "Discovery", id: 1381004916
mas "Drafts", id: 1435957248
mas "Enpass", id: 732710998
mas "FileBot", id: 905384638
mas "Interact Scratchpad", id: 1199660222
mas "Keynote", id: 409183694
mas "Mactracker", id: 430255202
mas "Mastonaut", id: 1450757574
mas "Mindcad Tiler", id: 432460453
mas "MindNode", id: 992076693
mas "Monit", id: 1014850245
mas "Moom", id: 419330170
mas "Notebooks", id: 1449826029
mas "Numbers", id: 409203825
mas "Pages", id: 409201541
mas "PDFify", id: 1435055351
mas "Pixelmator", id: 407963104
mas "Reeder", id: 1449412482
mas "ShutterCount", id: 720123827
mas "The Unarchiver", id: 425424353
mas "Todoist", id: 585829637
mas "Tweetbot", id: 557168941
mas "VPN Monitor", id: 887410814
mas "WhatsApp", id: 1147396723
mas "Xcode", id: 497799835

154
init/mac.sh Executable file
View File

@ -0,0 +1,154 @@
#!/usr/bin/env sh
# Inspired by https://github.com/mathiasbynens/dotfiles/blob/master/.macos from Mathias Bynens
MAC_HOSTNAME="leia"
# Close any open System Preferences panes, to prevent them from overriding
# settings were 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 &
# Set hostname
sudo scutil --set ComputerName "$MAC_HOSTNAME"
sudo scutil --set HostName "$MAC_HOSTNAME"
sudo scutil --set LocalHostName "$MAC_HOSTNAME"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$MAC_HOSTNAME"
# Always show scrollbars
defaults write NSGlobalDomain AppleShowScrollBars -string "Always"
# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
# Save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
# Automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# Disable the “Are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
# 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
# Reveal IP address, hostname, OS version, etc. when clicking the clock
# in the login window
sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName
# Disable automatic capitalization as its annoying when typing code
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
# Set a custom wallpaper image. `DefaultDesktop.jpg` is already a symlink, and
# all wallpapers are in `/Library/Desktop Pictures/`. The default is `Wave.jpg`.
#rm -rf ~/Library/Application Support/Dock/desktoppicture.db
#sudo rm -rf /System/Library/CoreServices/DefaultDesktop.jpg
#sudo ln -s /path/to/your/image /System/Library/CoreServices/DefaultDesktop.jpg
# Save screenshots to the desktop
defaults write com.apple.screencapture location -string "${HOME}/Desktop"
# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
defaults write com.apple.screencapture type -string "png"
# Disable shadow in screenshots
defaults write com.apple.screencapture disable-shadow -bool true
# Enable subpixel font rendering on non-Apple LCDs
# Reference: https://github.com/kevinSuttle/macOS-Defaults/issues/17#issuecomment-266633501
defaults write NSGlobalDomain AppleFontSmoothing -int 1
# Enable HiDPI display modes (requires restart)
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true
# Set $HOME as the default location for new Finder windows
# For other paths, use `PfLo` and `file:///full/path/here/`
defaults write com.apple.finder NewWindowTarget -string "PfLO"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}"
# 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
# Display full POSIX path as Finder window title
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
# Keep folders on top when sorting by name
defaults write com.apple.finder _FXSortFoldersFirst -bool true
# When performing a search, search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# Disable the 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
# 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"
#Enable AirDrop over Ethernet and on unsupported Macs running Lion
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true
# Show the /Volumes folder
sudo chflags nohidden /Volumes
# Expand the following File Info panes:
# “General”, “Open with”, and “Sharing & Permissions”
defaults write com.apple.finder FXInfoPanesExpanded -dict \
General -bool true \
OpenWith -bool true \
Privileges -bool true
# Dont group windows by application in Mission Control
# (i.e. use the old Exposé behavior instead)
defaults write com.apple.dock expose-group-by-app -bool false
# Dont automatically rearrange Spaces based on most recent use
defaults write com.apple.dock mru-spaces -bool false
# Hot corners
# Bottom left screen corner → Desktop
defaults write com.apple.dock wvous-bl-corner -int 4
defaults write com.apple.dock wvous-bl-modifier -int 0
# Check for software updates daily, not just once per week
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
# Kill affected apps
for app in "Activity Monitor" \
"cfprefsd" \
"Finder" \
"SystemUIServer"; do
killall "${app}" &> /dev/null
done
# Install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# Install apps from Brewfile
brew bundle