Skip to content

Instantly share code, notes, and snippets.

@dill
Last active February 28, 2019 16:31
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 dill/ec8aac92c89d87a1e90a89745ef12964 to your computer and use it in GitHub Desktop.
Save dill/ec8aac92c89d87a1e90a89745ef12964 to your computer and use it in GitHub Desktop.
Setup a new Mac 💻
#!/usr/bin/env bash
# David L Miller
# updated 28 February 2019
# taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# https://twitter.com/chadwhitaker/status/1004441991415922688
# https://www.idownloadblog.com/2014/08/03/how-to-remove-the-shadow-window-screenshots-on-mac-os-x/
# and elsewhere
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# write a message to say who this Mac belongs to
sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "A MESSAGE HERE"
# disable dashboard
defaults write com.apple.dashboard mcx-disabled -boolean YES && killall Dock
# Menu bar: disable transparency
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false
# Always show scrollbars
defaults write NSGlobalDomain AppleShowScrollBars -string "Always"
# Possible values: `WhenScrolling`, `Automatic` and `Always`
# 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
# Disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons
defaults write com.apple.finder QuitMenuItem -bool true
# 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
# Use list view in all Finder windows by default
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# Show the ~/Library folder
chflags nohidden ~/Library
# Wipe all (default) app icons from the Dock
# This is only really useful when setting up a new Mac, or if you don’t use
# the Dock to launch apps.
defaults write com.apple.dock persistent-apps -array
# Don’t automatically rearrange Spaces based on most recent use
defaults write com.apple.dock mru-spaces -bool false
# Enable the 2D Dock
defaults write com.apple.dock no-glass -bool true
# Automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true
# Prevent Time Machine from prompting to use new hard drives as backup volume
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
# Enable the debug menu in Disk Utility
defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true
defaults write com.apple.DiskUtility advanced-image-options -bool true
# stop xterm from running by default
# http://xquartz.macosforge.org/trac/wiki/X11-UsersFAQ
defaults write org.macosforge.xquartz.X11 app_to_run /usr/bin/true
# stop timemachine local backups
sudo tmutil disablelocal
# add a global .gitignore that ignores .DS_Store files
git config --global core.excludesfile ~/.gitignore
echo .DS_Store >> ~/.gitignore
# 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
# have Tweetbot open URLs without t.co
# https://twitter.com/dermdaly/status/664065150329163777
defaults write com.tapbots.TweetbotMac OpenURLsDirectly YES
# remove shadows from screenshots
defaults write com.apple.screencapture disable-shadow -bool true ; killall SystemUIServer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment