Skip to content

Instantly share code, notes, and snippets.

@dccampbell
Forked from iainconnor/setup.sh
Last active January 24, 2020 07:08
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 dccampbell/c23146a979b3fbcf1ce8243d56e73087 to your computer and use it in GitHub Desktop.
Save dccampbell/c23146a979b3fbcf1ce8243d56e73087 to your computer and use it in GitHub Desktop.
Mac OSX Setup
#!/usr/bin/env bash
# Ask for the administrator password upfront
sudo -v
# Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" || exit 1
# Configure Homebrew
brew doctor
# Custom Casks
brew tap caskroom/cask
brew tap caskroom/fonts
brew tap caskroom/versions
brew tap homebrew/core
brew tap homebrew/services
brew update && brew upgrade && brew cleanup
# Fonts
brew cask install font-dejavu-sans font-dejavusansmono-nerd-font font-droidsansmono-nerd-font
brew cask install font-fira-code font-fira-mono font-firacode-nerd-font font-firacode-nerd-font-mono
brew cask install font-inconsolata font-inconsolata-dz font-inconsolata-g
brew cask install font-noto-color-emoji font-noto-emoji font-noto-mono font-noto-sans font-noto-serif
# System
brew install autoconf bat boost coreutils curl findutils freetype gdbm gettext grc git gmp highlight icu4c imagemagick jpeg libevent libmemcached libpng libtiff libtool libxml2 liblzf lua mcrypt memcached mhash openssl pcre pkg-config re2c readline sqlite unixodbc unzip xz
brew install php72 composer
# Plugins
brew cask install qlimagesize qlmarkdown qlstephen quicklook-json
# Apps
brew cask install bettertouchtool karabiner-elements
brew cask install cyberduck go2shell imageoptim the-unarchiver
brew cask install jetbrains-toolbox sublime-text visual-studio-code
brew cask install vagrant #virtualbox
# Cleanup
brew update && brew upgrade && brew cleanup
#!/usr/bin/env bash
# Ask for the administrator password upfront
sudo -v
# Close any Preferences panes to prevent them from overriding changes
osascript -e 'tell application "System Preferences" to quit'
## General
# Disable the sound effects on boot
sudo nvram SystemAudioVolume=" "
# Set sidebar icon size to medium
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2
# Show scrollbars (WhenScrolling, Automatic, or Always)
defaults write NSGlobalDomain AppleShowScrollBars -string "Automatic"
# Expand Save and Print panels
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
# Save files locally by default
defaults write -g NSDocumentSaveNewDocumentsToCloud -bool false
# Disable application resume system-wide
defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false
# Disable automatic termination of inactive apps
defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true
# Disable auto-correct features
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# Restart automatically if the computer freezes
sudo systemsetup -setrestartfreeze on
# Quit Printer app when complete.
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# Ignore Quarantine of unknown apps.
defaults write com.apple.LaunchServices LSQuarantine -bool false
# Only use UTF-8 in Terminal.app
defaults write com.apple.terminal StringEncodings -array 4
# Disable Time Machine prompt for every disk.
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
# Require password after sleep/screensaver begins
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 30
# Change screenshot directory and file extension
mkdir ~/Pictures/Screenshots
defaults write com.apple.screencapture location ~/Pictures/Screenshots
defaults write com.apple.screencapture type -string "png"
# Configure Activity Monitor to always open a window, sorted by the most CPU intensive tasks.
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
defaults write com.apple.ActivityMonitor ShowCategory -int 0
defaults write com.apple.ActivityMonitor SortColumn -string "cpUUsage"
defaults write com.apple.ActivityMonitor SortDirection -int 0
## Input
# Mouse: Invert scrolling direction
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
# Trackpad: map bottom right corner to right-click
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1
defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true
# Keyboard: Enable full access for all controls (ex. Tab in modals)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# Keyboard: Disable press-and-hold in favor of key repeat
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
# Keyboard: Increase default repeat rate
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write NSGlobalDomain InitialKeyRepeat -int 12
## Dock
# Enable highlight hover effect for the grid view of a stack (Dock)
defaults write com.apple.dock mouse-over-hilite-stack -bool true
# Set the icon size of Dock items to 36 pixels
defaults write com.apple.dock tilesize -int 36
# Change minimize/maximize window effect
defaults write com.apple.dock mineffect -string "scale"
# Minimize windows into their application’s icon
defaults write com.apple.dock minimize-to-application -bool true
## Finder
# Open Finder at "~/" directory.
defaults write com.apple.finder NewWindowTarget -string "PfLo"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
# Use current directory as default search scope
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# Show hidden files and extensions
defaults write com.apple.finder AppleShowAllFiles -bool true
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Show path bar
defaults write com.apple.finder ShowPathbar -bool true
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
# Show status bar
defaults write com.apple.finder ShowStatusBar -bool true
# Set default file view (icnv, Nlsv, clmv, or Flwv)
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# Allow selecting text in Quick Look.
defaults write com.apple.finder QLEnableTextSelection -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
# Don't create temporary files to network and USB drives
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -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
# Enable snap-to-grid for icons
/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
# Show the ~/Library and /Volumes folders
chflags nohidden ~/Library
sudo chflags nohidden /Volumes
## Safari
# Press Tab to highlight each item on a web page
defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true
# Show the full URL in the address bar (note: this still hides the scheme)
defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true
# Set Safari’s home page to `about:blank`
defaults write com.apple.Safari HomePage -string "about:blank"
# Prevent Safari from opening ‘safe’ files automatically after downloading
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
# Hide Safari’s sidebar in Top Sites
defaults write com.apple.Safari ShowSidebarInTopSites -bool false
# Disable Safari’s thumbnail cache for History and Top Sites
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
# Enable Safari’s debug menu
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
# Make Safari’s search banners default to Contains instead of Starts With
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
# 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
# Enable spellchecking but disable auto-correct
defaults write com.apple.Safari WebContinuousSpellCheckingEnabled -bool true
defaults write com.apple.Safari WebAutomaticSpellingCorrectionEnabled -bool false
# Disable AutoFill
defaults write com.apple.Safari AutoFillFromAddressBook -bool false
defaults write com.apple.Safari AutoFillPasswords -bool false
defaults write com.apple.Safari AutoFillCreditCardData -bool false
defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false
# Warn about fraudulent websites
defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true
# Enable “Do Not Track”
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true
# Update extensions automatically
defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true
##
echo "Configuration Complete. Please restart the OS."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment