Created
August 30, 2021 13:28
-
-
Save austinsonger/3069cba70bb6c41eeaeea64b965c3db6 to your computer and use it in GitHub Desktop.
An initialization script for new MacBooks
This file contains hidden or 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
#!/bin/sh | |
# To run: `sh -c "$(curl https://gist.githubusercontent.com/5c077m4n/2e27f6ef11dea84071845fd85fc9fd84/raw)"` | |
# 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' | |
# Disable the sound effects on boot | |
sudo nvram SystemAudioVolume=" " | |
# 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 | |
############################################################################### | |
# Trackpad, mouse, keyboard, Bluetooth accessories, and input # | |
############################################################################### | |
# 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 press-and-hold for keys in favor of key repeat | |
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false | |
# Set a blazingly fast keyboard repeat rate | |
defaults write NSGlobalDomain KeyRepeat -int 1 | |
defaults write NSGlobalDomain InitialKeyRepeat -int 10 | |
############################################################################### | |
# Energy saving # | |
############################################################################### | |
# Enable lid wakeup | |
sudo pmset -a lidwake 1 | |
# Sleep the (display)sleep after _ minutes on charger/UPS | |
sudo pmset -cu displaysleep 15 | |
sudo pmset -cu sleep 20 | |
# Set machine (display)sleep to _ minutes on battery | |
sudo pmset -b displaysleep 4 | |
sudo pmset -b sleep 5 | |
############################################################################### | |
# Screen # | |
############################################################################### | |
# Disable shadow in screenshots | |
defaults write com.apple.screencapture disable-shadow -bool true | |
############################################################################### | |
# Finder # | |
############################################################################### | |
# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons | |
defaults write com.apple.finder QuitMenuItem -bool true | |
# Finder: disable window animations and Get Info animations | |
defaults write com.apple.finder DisableAllAnimations -bool true | |
# Set Desktop as the default location for new Finder windows | |
# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons | |
defaults write com.apple.finder QuitMenuItem -bool true | |
# Finder: disable window animations and Get Info animations | |
defaults write com.apple.finder DisableAllAnimations -bool true | |
# Set Desktop as the default location for new Finder windows | |
# For desktop, use `PfDe` and `file://${HOME}/Desktop/` | |
# 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}/Downloads/" | |
# 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 hidden files by default | |
#defaults write com.apple.finder AppleShowAllFiles -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 | |
defaults write com.apple.finder NewWindowTarget -string "PfDe" | |
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/" | |
# 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 hidden files by default | |
defaults write com.apple.finder AppleShowAllFiles -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 | |
# 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 | |
# Show item info near icons on the desktop and in other icon views | |
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist | |
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist | |
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist | |
# Show item info to the right of the icons on the desktop | |
/usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist | |
# Enable snap-to-grid for icons on the desktop and in other icon views | |
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist | |
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist | |
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist | |
# 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" | |
# 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 | |
############################################################################### | |
# Activity Monitor # | |
############################################################################### | |
# Show the main window when launching Activity Monitor | |
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true | |
# Visualize CPU usage in the Activity Monitor Dock icon | |
defaults write com.apple.ActivityMonitor IconType -int 5 | |
# Show all processes in Activity Monitor | |
defaults write com.apple.ActivityMonitor ShowCategory -int 0 | |
# Sort Activity Monitor results by CPU usage | |
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" | |
defaults write com.apple.ActivityMonitor SortDirection -int 0 | |
############################################################################### | |
# Photos # | |
############################################################################### | |
# Prevent Photos from opening automatically when devices are plugged in | |
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true | |
############################################################################### | |
# Brew # | |
############################################################################### | |
# Install script | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
BREW_PREFIX=$(brew --prefix) | |
brew update | |
brew upgrade | |
brew upgrade --cask | |
# Install some other useful utilities like `sponge`. | |
brew install moreutils | |
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, `g`-prefixed. | |
brew install findutils | |
# Install GNU core utilities (those that come with macOS are outdated). | |
# Don’t forget to add `$(brew --prefix coreutils)/libexec/gnubin` to `$PATH`. | |
brew install coreutils | |
ln -s "${BREW_PREFIX}/bin/gsha256sum" "${BREW_PREFIX}/bin/sha256sum" | |
# Install a modern version of Bash. | |
brew install bash | |
# Install GnuPG to enable PGP-signing commits. | |
brew install gnupg | |
# Install more recent versions of some macOS tools. | |
brew install neovim | |
brew install grep | |
brew install openssh | |
brew install gimp | |
# Dev tools. | |
brew install node | |
brew install python | |
brew install --cask docker | |
brew install --cask visual-studio-code | |
# Node deps. | |
npm install -g yarn | |
npm install -g eslint | |
npm install -g prettier | |
# Install other useful binaries. | |
brew install git | |
brew install ack | |
brew install rg | |
brew install ag | |
brew install fd | |
brew install jq | |
brew install yq | |
brew install ack | |
brew install lynx | |
brew install tree | |
brew install wget | |
brew install curl | |
brew install --cask iterm2 | |
brew install --cask rectangle | |
brew install --cask copyq | |
brew install --cask firefox | |
brew install --cask google-chrome | |
brew install --cask slack | |
brew install --cask zoom | |
# Oh-my-zsh | |
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
# Powerlevel10k zsh theme (don't forget to add `ZSH_THEME="powerlevel10k/powerlevel10k"` to your `~/.zshrc` file) | |
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment