Helps when the desktop freezes, folders won't open, or file icons stop refreshing.
killall FinderTerminal commands you actually need. Each one states whether it needs sudo, how risky it is, and how to undo it.
57 macOS terminal commands across 9 categories. Each is tagged with a danger level, a sudo flag, and — where it applies — a revert command, so a tweak can always be walked back. Homebrew paths are substituted for your CPU architecture.
Helps when the desktop freezes, folders won't open, or file icons stop refreshing.
killall FinderRestarts the app panel. Fixes frozen animations or window switching issues (Cmd+Tab).
killall DockReloads the macOS menu bar. Use when clock, Wi-Fi, battery, or status menu icons freeze.
killall SystemUIServerResets the system font cache. Fixes boxes, question marks, or garbled text in apps. Restart your Mac afterwards.
sudo atsutil databases -remove && atsutil server -shutdownRestarts the audio daemon. Fixes an unresponsive volume control, missing sound, or crackling.
sudo killall coreaudiodReloads the Bluetooth stack. Helps when AirPods, wireless mice, or keyboards fail to connect.
sudo killall bluetoothdSets output volume as a percentage (0–100). Handy in scripts or when volume keys stop working.
osascript -e "set volume output volume 50"Resets the local DNS cache. Use when a site won't open, shows an old IP, or returns a DNS error.
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderReloads the en0 wireless module. The connection drops completely for a few seconds.
sudo ifconfig en0 down && sudo ifconfig en0 upRequests a fresh IP address from the router. Helps with address conflicts or "connected but no internet".
sudo ipconfig set en0 DHCPPrints the Mac's LAN IP (e.g. 192.168.1.42). Needed for SSH, file sharing, and dev servers.
ipconfig getifaddr en0Prints the external IP the internet sees you from. Useful for checking VPNs and allowlists.
curl ifconfig.meShows which processes await network connections. Finds "who took port 3000" and suspicious services.
sudo lsof -i -P -n | grep LISTENPulls the network password from the Keychain. Replace SSID with the network name; macOS asks for the admin password.
security find-generic-password -ga "SSID" -wForces Spotlight to reindex the main disk. Fixes search not finding files. Indexing takes a while.
sudo mdutil -E /Restarts the background mds process. Helps when indexing hangs or mds_stores hogs the CPU.
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist && sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plistResets the quick-preview service used when you press Space in Finder.
qlmanage -r && qlmanage -r cachePrints the system name, version, and build — the first line of any bug report.
sw_versPrints arm64 on Apple Silicon and x86_64 on Intel. It decides your Homebrew path and half the instructions you find online.
uname -mThe translation layer Intel-only apps need to launch at all. Installed once per machine. The --agree-to-license flag accepts the licence without a dialog.
softwareupdate --install-rosetta --agree-to-licenseShows time since the last reboot and average CPU load over 1, 5, and 15 minutes.
uptimeAn instant snapshot of the hungriest processes without opening Activity Monitor.
ps aux | sort -nrk 3 | head -10Drops the disk cache held in RAM. May briefly free memory, but the system refills caches later — use sparingly.
sudo purgeKeeps the Mac awake during long tasks (rendering, downloads). Press Ctrl+C to stop.
caffeinate -iKeeps the Mac awake for exactly 3600 seconds (1 hour), then restores normal behavior. Adjust the number as needed.
caffeinate -i -t 3600Lists processes and assertions preventing sleep. The answer to "why won't it fall asleep".
pmset -g assertionsCharge percentage, power source, and time remaining — faster than reaching for the menu.
pmset -g battFull dump of power settings: sleep timers, disk and display sleep, lid behavior.
pmset -gShows whether Gatekeeper app assessment is enabled.
spctl --statusStrips the Gatekeeper quarantine flag — fixes "app is damaged". Replace the path with yours.
xattr -d com.apple.quarantine /Applications/AppName.appShows whether full-disk encryption is on and if encryption is in progress.
fdesetup statusShows whether the firewall blocking incoming connections is enabled.
/usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstateShows everything in ~/.ssh: id_ed25519/id_rsa key pairs, known_hosts, config.
ls -al ~/.sshShows used and free space on all mounted volumes in human-readable form.
df -hPrints the hierarchy of disks, APFS volumes, and containers — required before any partition work.
diskutil listEjects a volume Finder refuses to unmount ("disk in use"). Replace NAME with the volume name.
diskutil eject /Volumes/NAMEPermanently deletes Trash contents, including stuck files Finder can't remove.
rm -rf ~/.Trash/*Frees tens of gigabytes: Xcode's intermediate builds and indexes. Projects survive — they rebuild on next launch.
rm -rf ~/Library/Developer/Xcode/DerivedDataChecks the file system for errors without making changes. May take several minutes.
sudo diskutil verifyVolume /The official package manager install script. Asks for your password and installs Xcode Command Line Tools.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"The final install step people skip most often: without it the shell answers "brew: command not found". The path depends on the CPU — the command above is already set for the architecture you picked.
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile && eval "$(/opt/homebrew/bin/brew shellenv)"Refreshes the formula catalog and upgrades every installed package and app.
brew update && brew upgradeShows formulae and apps with newer versions available, without installing anything.
brew outdatedRemoves cached old package versions and unneeded dependencies. Frees noticeable disk space.
brew cleanup && brew autoremoveChecks the brew installation for common issues: permissions, PATH, conflicts. The first command for any trouble.
brew doctorShows formulae you installed explicitly (no dependencies) plus GUI apps from cask.
brew leaves && brew list --caskSubmit a request or write to me directly on Telegram. I'll reply within 24 hours.