Homebrew
brew update # fetch latest formulae
brew upgrade # upgrade all outdated packages
brew upgrade <pkg> # upgrade specific package
brew cleanup # remove old versions
brew doctor # diagnose issues
brew list # installed packages
brew info <pkg> # details + dependencies
# Install casks (GUI apps)
brew install --cask warp
brew install --cask visual-studio-code
# Fix permissions after macOS update (Apple Silicon)
sudo chown -R $(whoami) /opt/homebrew
Terminal Utilities
# Open files/folders in Finder (or default app)
open . # open current directory in Finder
open ~/Downloads # open folder
open file.pdf # open with default app
open -a "Safari" https://example.com
# Clipboard
echo "hello" | pbcopy # copy to clipboard
pbpaste # print clipboard contents
pbpaste > file.txt # paste into file
# Prevent Mac from sleeping
caffeinate # run until Ctrl+C
caffeinate -t 3600 # sleep prevention for 1 hour
# Text to speech
say "Build complete"
# Show/hide hidden files in Finder via terminal
defaults write com.apple.finder AppleShowAllFiles true && killall Finder
defaults write com.apple.finder AppleShowAllFiles false && killall Finder
Shell
# Make a script executable
chmod +x ./script.sh
# Show what's listening on a port
lsof -i :3000
lsof -i :3000 | grep LISTEN
# Kill process on a port
kill -9 $(lsof -t -i :3000)
Network
# Flush DNS cache
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder
# Show Wi-Fi network name
networksetup -getairportnetwork en0
# List all network services
networksetup -listallnetworkservices
# Show current IP addresses
ifconfig | grep "inet "
Screenshots
| Shortcut | Result |
|---|
Cmd + Shift + 3 | Full screen → file on Desktop |
Cmd + Shift + 4 | Selection → file on Desktop |
Cmd + Shift + 4, then Space | Click window → file on Desktop |
Cmd + Shift + 5 | Screenshot/recording options panel |
Add Ctrl to any above | Capture to clipboard instead of file |
Finder Shortcuts
| Shortcut | Action |
|---|
Cmd + Shift + . | Toggle hidden files |
Cmd + Shift + G | Go to folder (type path) |
Cmd + Space | Spotlight search |
Space | Quick Look selected file |
Cmd + Delete | Move to Trash |
Cmd + Shift + Delete | Empty Trash |
Cmd + Option + L | Open Downloads folder |
Chrome
| Setting | Path |
|---|
| Do Not Track | Settings → Privacy and security → Do not track |