Skip to content

Instantly share code, notes, and snippets.

@michaeldever
Last active February 13, 2021 15:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save michaeldever/4be94b7dac9add53cc2025522d620ec7 to your computer and use it in GitHub Desktop.
Save michaeldever/4be94b7dac9add53cc2025522d620ec7 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Install:
# sh -c "$(curl -fsSL https://gist.githubusercontent.com/michaeldever/4be94b7dac9add53cc2025522d620ec7/raw/1297ba9b60542e5dd70ab107951ce1c2fac94185/install.sh)"
# References:
# https://gist.github.com/bradp/bea76b16d3325f5c47d4
# https://gist.github.com/CliffordAnderson/817777b5dc0e67769e4b
# https://gist.github.com/codeinthehole/26b37efa67041e1307db
# https://github.com/thoughtbot/laptop/blob/master/mac
# https://github.com/donnemartin/dev-setup
# https://gist.github.com/brandonb927/3195465/
PACKAGES=(
awscli
coreutils
ffmpeg
findutils
git
heroku
hub
imagemagick
libidn
libmagic
libxml2
libxslt
libyaml
mackup
mas
nginx
npm
openssl
postgres
redis
s3cmd
vim
watchman
wget
yarn
zsh
)
CASKS=(
figma
firefox
google-chrome
ipvanish-vpn
notion
postico
postman
spotify
visual-studio-code
vlc
zoomus
)
TAPS=(
heroku/brew
)
MAS_APPS=(
409183694 # Keynote
409201541 # Pages
409203825 # Numbers
497799835 # XCode
1451544217 # Lightroom
425424353 # The Unarchiver
1333542190 # 1 Password
736189492 # Notability
1502111349 # PDF Squeezer
803453959 # Slack
406056744 # Evernote
)
NPM_PACKAGES=(
local-cors-proxy
serve
)
# Sudo keep-alive
sudo -v
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
if test ! $(which brew); then
echo "Installing homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
fi
brew update --force
brew upgrade
brew tap heroku/brew
brew update
brew install ${PACKAGES[@]}
brew link --force libxslt
brew link --force libxml2
brew update
brew install --cask --appdir="/Applications" ${CASKS[@]}
brew cleanup
echo "Installing NPM Packages"
npm install -g ${NPM_PACKAGES[@]}
echo "Installing MAS Apps"
mas install ${MAS_APPS[@]}
echo "Setting up Git"
git config --global user.name "Michael Dever"
git config --global user.email "michaelcdever@gmail.com"
git config --global core.ignorecase false
git config --global color.ui true
git config --global pull.rebase false
echo "Setting up SSH"
ssh-keygen -t rsa -C "michaelcdever@gmail.com"
echo "Setting up OSX"
########
# Dock #
########
# Autohide Settings
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock autohide-delay -float 0
defaults write com.apple.dock autohide-time-modifier -float 0
# Setting the icon size
defaults write com.apple.dock tilesize -int 16
# Minimize windows to dock icon
defaults write com.apple.dock minimize-to-application -bool true
###############
# Screenshots #
###############
# 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
##########
# Finder #
##########
# Only show scrollbars when scrolling
defaults write NSGlobalDomain AppleShowScrollBars -string "WhenScrolling"
# Disable disk image verification
defaults write com.apple.frameworks.diskimages skip-verify -bool true
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
# Show hidden files
defaults write com.apple.finder AppleShowAllFiles TRUE
# Show path bar
defaults write com.apple.finder ShowPathbar -bool true
# Show filename extensions by default
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Disabling the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Use column view in all Finder windows by default
defaults write com.apple.finder FXPreferredViewStyle Clmv
# Avoiding the creation of .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# Allow text selection in Quick Look
defaults write com.apple.finder QLEnableTextSelection -bool true
# Disable the “Are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
################
# Time Machine #
################
# Preventing Time Machine from prompting to use new hard drives as backup volume
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
############
# Messages #
############
# Disable smart quotes
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false
# Disable automatic emoji substitution (i.e. use plain text smileys)
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false
# Disable continuous spell checking
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false
############
# Printing #
############
# Automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
############
# Keyboard #
#############
# Disable smart quotes and smart dashes
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
# Enabling full keyboard access for all controls (e.g. enable Tab in modal dialogs)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# Enable key repeat over special character select
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
############
# Terminal #
############
# Enabling UTF-8 ONLY in Terminal.app and setting the Pro theme by default
defaults write com.apple.terminal StringEncodings -array 4
defaults write com.apple.Terminal "Default Window Settings" -string "Pro"
defaults write com.apple.Terminal "Startup Window Settings" -string "Pro"
##########
# Chrome #
##########
# Disable the all too sensitive backswipe on Magic Mouse
defaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -bool false
# Use the system-native print preview dialog
defaults write com.google.Chrome DisablePrintPreview -bool true
# Expand the print dialog by default
defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true
##########
# Safari #
##########
# Hiding Safari's bookmarks bar by default
defaults write com.apple.Safari ShowFavoritesBar -bool false
# Hiding Safari's sidebar in Top Sites
defaults write com.apple.Safari ShowSidebarInTopSites -bool false
# Disabling Safari's thumbnail cache for History and Top Sites
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
# Enabling Safari's debug menu
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
# Making Safari's search banners default to Contains instead of Starts With
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
# Removing useless icons from Safari's bookmarks bar
defaults write com.apple.Safari ProxiesInBookmarksBar "()"
# Allow hitting the Backspace key to go to the previous page in history
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true
# Enabling 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
# Privacy: don’t send search queries to Apple
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
# 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` for faster loading
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
# Adding a context menu item for showing the Web Inspector in web views
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
########
# Mail #
########
# Display emails in threaded mode, sorted by date (oldest at the top)
defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes"
defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortedDescending" -string "yes"
defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortOrder" -string "received-date"
# Disable inline attachments (just show the icons)
defaults write com.apple.mail DisableInlineAttachmentViewing -bool true
# Setting email addresses to copy as 'foo@example.com' instead of 'Foo Bar <foo@example.com>' in Mail.app
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
############
# Trackpad #
############
# 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
# Setting trackpad & mouse speed to a reasonable number
defaults write -g com.apple.trackpad.scaling 2
defaults write -g com.apple.mouse.scaling 2.5
############
# Security #
############
# Empty Trash securely by default
defaults write com.apple.finder EmptyTrashSecurely -bool true
# Setup sleep bottom left corner
defaults write com.apple.dock wvous-bl-corner -int 10
defaults write com.apple.dock wvous-bl-modifier -int 0
# Require password as soon as screensaver or sleep mode starts
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
# Check for software updates daily, not just once per week
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
# Disable hibernation
sudo pmset -a hibernatemode 0
#########
# Media #
#########
# Increase sound quality for Bluetooth headphones/headsets
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
# Disable Photos.app from starting everytime a device is plugged in
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
###########
# Display #
###########
# Enabling subpixel font rendering on non-Apple LCDs
defaults write NSGlobalDomain AppleFontSmoothing -int 2
# Enable HiDPI display modes (requires restart)
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true
############
# Hardware #
############
# Disable the sudden motion sensor as its not useful for SSDs
sudo pmset -a sms 0
# Speeding up wake from sleep to 24 hours from an hour
# http://www.cultofmac.com/221392/quick-hack-speeds-up-retina-macbooks-wake-from-sleep-os-x-tips/
sudo pmset -a standbydelay 86400
# Install RVM
\curl -sSL https://get.rvm.io | bash -s stable
# Install OhMyZSH
echo "Installing ZSH"
curl -L http://install.ohmyz.sh | sh
git clone https://github.com/romkatv/powerlevel10k.git $HOME/.oh-my-zsh/custom/themes/powerlevel10k
# Restoring Configuration
echo "Restoring Configuration"
echo "[storage]\nengine = icloud" >> ~/.mackup.cfg
mackup backup --force
mackup restore --force
killall Finder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment