Skip to content

Instantly share code, notes, and snippets.

@zbstof
Last active January 24, 2024 06:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zbstof/63994d0a33be2bb0d8a382aa4788b20f to your computer and use it in GitHub Desktop.
Save zbstof/63994d0a33be2bb0d8a382aa4788b20f to your computer and use it in GitHub Desktop.
Setup new Mac quickly
####### Set Up ########
# From https://github.com/mathiasbynens/dotfiles/blob/master/.macos :
# 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'
###### Install software ######
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install coreutils # gnu tools - everything has prefix g* - gsed, etc.
brew install grep # gnu grep - grep
brew install python3
brew install wget
brew install telnet
brew install httpie
brew install ipython
brew install nmap
brew install tree
brew install ag
brew install git
brew install jq
brew install node
brew install redis
brew install html-xml-utils # parse html and run ccs selectors on it from bash
brew install gnu-sed
brew cask install java
brew cask install homebrew/cask-versions/adoptopenjdk8
brew install maven # needs jdk
brew install groovysdk # needs jdk
brew install groovy
brew install scala@2.11 # needs jdk
# Set scala in idea to /usr/local/Cellar/scala\@2.11/2.11.12/idea/
# Create symlink to the 2.11 scala
sudo ln -f "/usr/local/Cellar/scala@2.11/2.11.12/bin/scala" /usr/local/bin/scala
brew install sbt
brew install youtube-dl; brew install libav
brew install ncdu
brew install pstree
brew tap teamookla/speedtest; brew install speedtest --force
brew cask install horndis; sudo kextload /Library/Extensions/HoRNDIS.kext # android tethering on mac
# this will ask for sudo
brew cask install google-chrome
brew cask install docker
brew cask install kitematic
brew cask install zoomus
brew cask install intellij-idea
brew cask install ukelele
brew cask install beyond-compare
brew cask install postman
brew cask install ngrok
brew cask install keycastr
brew cask install vlc
brew cask install jd-gui
brew cask install keepassxc
brew cask install transmission
brew cask install android-file-transfer
brew cask install charles
brew cask install wireshark
brew cask install visual-studio-code
brew cask install wkhtmltopdf # take screenshots from bash
brew cask install michaelvillar-timer # simple countdown timer
brew cask install android-platform-tools # adb
brew cask install BitBar # for mac taskbar
#brew cask install oni
#defaults write com.extropy.oni ApplePressAndHoldEnabled -bool false
###### Manual changes ######
# TODO: move to defaults. How to find out what changed? - Monitor files config files for changes and print the diff?
# Preferences -> Energy Saver -> Battery -> Turn off display after -> 15 minutes
# Preferences -> Displays -> Night Shift -> Schedule -> Sunset to Sunrize
# Preferences -> General -> Appearance -> Use dark menu bar and Dock ### Dark theme
# Preferences -> Keyboard -> Text -> Disable 'Use smart quotes and dashes'
# Preferences -> Keyboard -> Keyboard -> Customize control strip -> Drag buttons around (add sleep, at least)
# Preferences -> Keyboard -> Keyboard -> Touch Bar shows -> "F1, F2, etc. Keys"
# Preferences -> Keyboard -> Shortcuts -> Mission Control -> untick "Show dashboard", "Show desktop"
# Preferences -> Sound -> Input -> Show volume in menu bar
# Untick all XXX shortcuts except 'Keyboard' and 'Screenshots':
# Preferences -> Keyboard -> Shortcuts -> XXX -> Untick YYY
# Preferences -> Keyboard -> Keyboard -> tick 'Show keyboard and emoji viewers in menu bar'
# Preferences -> Language & Region -> Time format -> Tick '24-Hour time'
# Preferences -> Trackpad -> More Gestures -> Untick 'Swipe between pages'
# Preferences -> Notifications -> Do Not Disturb -> Turn on Do not Distrub -> Untick 'When mirroring to TVs and projectors'
# Finder -> Preferences -> Advanced -> Tick 'Show all filename extensions'
# Finder -> Preferences -> Advanced -> Untick 'Show warning before changing an extension'
# Finder -> Preferences -> Advanced -> Tick 'Keep folder on top when sorting by name'
# Finder -> Preferences -> Advanced -> When performing a search: 'Search the Current folder'
# Finder -> Preferences -> Sidebar -> ...
# Safari -> Preferences -> Advanced -> Show Develop Menu in menu bar ### Safari dev tools
# iTerm -> Preferences -> Profiles -> Terminal tab -> Check "Silence bell"/"Flash visual bell" #### Turn off iTerm beep sound
# iTerm -> Preferences -> Profiles -> Colors -> Color Presets -> Solorized Dark #### Color scheme
# iTerm -> Preferences -> Profiles -> Keys -> Left Option Key -> Esc+ #### Alt key
# iTerm -> Preferences -> Profiles -> Terminal -> Scrollback Lines -> Unlimited scrollback #### Unlimited scrollback
# Terminal -> Preferences -> Profiles -> 'Basic' -> Keyboard -> Tick 'Use Option as Meta Key'
# Terminal -> Preferences -> Profiles -> 'Basic' -> Advanced -> (untick) Audible Bell, Only when sound is muted
# Idea -> Preferences -> Editor -> Plugins -> Browse repositories -> .ignore
# Idea -> Preferences -> Editor -> Plugins -> Browse repositories -> BashSupport
# Idea -> Preferences -> Editor -> Plugins -> Browse repositories -> Markdown Navigator
# Idea -> Preferences -> Editor -> Plugins -> Browse repositories -> Lombok Plugin
# Idea -> Preferences -> Editor -> Plugins -> Browse repositories -> String manipulation
# Idea -> Preferences -> Editor -> Plugins -> Browse repositories -> Key Promoter X
# Idea -> Preferences -> Editor -> Plugins -> Browse repositories -> Bitbucket Linky
# Idea -> Preferences -> Editor -> Color Scheme -> Language Defaults -> Semantic Highlighting -> Tick 'Semantic Highlighting'
# Idea -> Preferences -> Editor -> Font -> Font -> Fira Code (also next line)
# Idea -> Preferences -> Editor -> Font -> Enable Font ligatures (also next line)
# Idea -> Preferences -> Editor -> Font -> Size -> 13
# Idea -> Preferences -> Editor -> Color Scheme -> Color Scheme Font -> ... set the same as above
# Idea -> Preferences -> Editor -> Virtual Space -> Show virtual space at file bottom
# Modify `vim "/Applications/IntelliJ IDEA.app/Contents/bin/idea.properties"`: `idea.cycle.buffer.size=disabled`
#### Bash v4 - Manual bacause manual switch to sudo ####
# brew install bash
# sudo su -
# echo "/usr/local/bin/bash" >> /etc/shells
# exit
# sudo chsh -s /usr/local/bin/bash
# chsh -s /usr/local/bin/bash
#### Auth sudo with touchID ####
# https://apple.stackexchange.com/a/306324
#### ukrainian keyboard ####
# downaload https://gist.github.com/zbstof/148e87a16375831a1e88d61081a4597f import in ukelele
cd ~/Documents
wget https://gist.githubusercontent.com/zbstof/148e87a16375831a1e88d61081a4597f/raw/3c65824ae873f16e2cb46ae811d30b89218e2484/Ukrainian.keylayout
open Ukrainian.keylayout
# Note: don't use US International, as it does some wierdness with quotation marks
########################
#### General UI/UX ####
# 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
# Disable the “Are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
# 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 it’s annoying when typing code
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
# Disable smart dashes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
# Disable automatic period substitution as it’s annoying when typing code
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
# Disable smart quotes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
# Disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# Dark menu bar TODO restarting SystemUIServer doesn't help
defaults write NSGlobalDomain AppleInterfaceStyle -string Dark
# Set Apperance to graphite
defaults write NSGlobalDomain AppleAquaColorVariant -int 6
# 24-hour time in menu clock
defaults write com.apple.menuextra.clock DateFormat -string 'EEE MMM d H:mm'
killall SystemUIServer
#### Finder ####
# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons
defaults write com.apple.finder QuitMenuItem -bool true
# Set HOME as the default location for new Finder windows
defaults write com.apple.finder NewWindowTarget -string "PfLo"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}"
# 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
# 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`, `Flwv`
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# Show the ~/Library folder
chflags nohidden ~/Library
# Show the /Volumes folder
sudo chflags nohidden /Volumes
killall Finder
#### Screenshots ####
# Set new screenshot location
mkdir ~/Screenshots
defaults write com.apple.screencapture location ~/Screenshots
# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
defaults write com.apple.screencapture type -string "png"
killall SystemUIServer
# TODO: add location to Finder shortcuts
#### Dock ####
# Wipe every default app from dock
defaults delete com.apple.dock persistent-apps
defaults delete com.apple.dock persistent-others
# Prevent icons from bouncing
defaults write com.apple.dock no-bouncing -bool TRUE
# Pin dock to left
defaults write com.apple.dock orientation -string "left"
# Minimize windows into their application’s icon
defaults write com.apple.dock minimize-to-application -bool true
killall Dock
#### Text Edit ####
# Use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText NO
# Open and save files as UTF-8 in TextEdit
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
#### Safari ####
# 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
#### Spotlight ####
# Todo: disable Command+Space shortcut
#### Terminal & iTerm2 ####
# Only use UTF-8 in Terminal.app
defaults write com.apple.terminal StringEncodings -array 4
# Hover over a window and start typing in it without clicking first
defaults write com.apple.terminal FocusFollowsMouse -bool true
# Enable Secure Keyboard Entry in Terminal.app
# See: https://security.stackexchange.com/a/47786/8918
defaults write com.apple.terminal SecureKeyboardEntry -bool true
# Use alt as Meta key
/usr/libexec/PlistBuddy -c "set :Window\ Settings:Basic:useOptionAsMetaKey true" ~/Library/Preferences/com.apple.Terminal.plist
# Don’t display the annoying prompt when quitting iTerm
defaults write com.googlecode.iterm2 PromptOnQuit -bool false
killall Terminal
#### Quick Look ####
# Quick look for everything
brew install Caskroom/cask/qlstephen; qlmanage -r
# Quick look for webp
curl -L https://raw.github.com/emin/WebPQuickLook/master/install.sh | sh
#### 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
killall "Activity Monitor"
#### Chrome ####
# Disable the all too sensitive backswipe on trackpads
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false
# Expand the print dialog by default
defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true
killall "Google Chrome"
#### Transmission ####
# Trash original torrent files
defaults write org.m0k.transmission DeleteOriginalTorrent -bool true
killall Transmission
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment