cheat sheet
macOS CLI
Comprehensive macOS terminal reference covering file management, processes, networking, Homebrew, defaults, diskutil, launchctl, pbcopy/pbpaste, open, say, and power-user recipes.
macOS CLI — Command Line Reference
What it is
macOS ships with a rich set of command-line utilities that extend standard Unix tools with Apple-specific capabilities — defaults for reading and writing preference plists, pbcopy/pbpaste for clipboard integration, open for launching apps and files from the terminal, say for text-to-speech, caffeinate for preventing sleep, launchctl for managing launchd agents, and networksetup for network configuration. These tools are maintained by Apple as part of macOS and require no additional installation. Reach for them when you want to automate or script macOS system behavior that has no direct equivalent in standard POSIX utilities.
Shell & environment
macOS has used zsh as the default login shell since Catalina (10.15); older systems defaulted to bash. System-wide settings live in /etc/zshrc and /etc/zprofile; per-user config goes in ~/.zshrc (interactive) and ~/.zprofile (login). Use chsh -s to switch shells permanently.
echo $SHELL # current shell (/bin/zsh on modern macOS)
chsh -s /bin/zsh # switch to zsh
chsh -s /bin/bash # switch to bash
echo $PATH # view PATH
export PATH="/usr/local/bin:$PATH" # prepend to PATH (add to ~/.zshrc to persist)
env # all environment variables
printenv HOME # single variable
source ~/.zshrc # reload zsh config
exec $SHELL -l # reload shell login
Output: (none — exits 0 on success)
File & directory
macOS ships with BSD-derived ls, cp, mv, stat, and find rather than their GNU counterparts. Key differences: stat output format differs from GNU; cp -a preserves extended attributes and resource forks; readlink -f is not available in BSD and requires greadlink (via coreutils) for fully resolved paths. Install coreutils via Homebrew to get GNU-compatible versions prefixed with g.
ls -la # long listing, hidden files
ls -lhS # sort by size, human-readable
ls -lt # sort by modification time
ls -1 # one file per line
pwd # print working directory
cd - # go to previous directory
cd ~ # go to home
mkdir -p a/b/c # create nested directories
rmdir dir # remove empty directory
rm -rf dir # remove directory and contents (careful!)
cp -R src/ dst/ # copy directory recursively
cp -a src/ dst/ # preserve attributes + recursive
mv old new # move / rename
ln -s /path/to/target link # create symlink
readlink -f link # resolve symlink to real path
touch file.txt # create empty file / update timestamp
file image.png # detect file type
du -sh * # sizes of items in current dir
du -sh ~/Downloads # size of a folder
df -h # disk free, human readable
Output: (none — exits 0 on success)
Finder & open
open is the macOS equivalent of xdg-open on Linux — it launches files, directories, and URLs with the appropriate default application. It is the primary way to bridge the terminal and the GUI: open a project directory in Finder, reveal a file, or trigger the default browser from a script.
open . # open current dir in Finder
open file.pdf # open with default app
open -a "Visual Studio Code" . # open with specific app
open -R file.txt # reveal file in Finder
open https://example.com # open URL in default browser
# Reveal hidden files in Finder
defaults write com.apple.Finder AppleShowAllFiles true
killall Finder
# Show/hide Desktop icons
defaults write com.apple.finder CreateDesktop false && killall Finder
defaults write com.apple.finder CreateDesktop true && killall Finder
Output: (none — exits 0 on success)
Clipboard
pbcopy and pbpaste are macOS-only tools with no Linux equivalent (use xclip or xsel on Linux). They pipe data in and out of the system pasteboard, making it trivial to move command output into other apps or paste clipboard content into files from the terminal.
pbcopy < file.txt # copy file contents to clipboard
pbpaste > file.txt # paste clipboard to file
echo "hello" | pbcopy # copy command output
pbpaste # print clipboard to stdout
# Useful combos
pwd | pbcopy # copy current path
cat ~/.ssh/id_ed25519.pub | pbcopy # copy SSH public key
Output:
/Users/alice/projects/my-app
Text-to-speech
say wraps the macOS Speech Synthesis engine and has no direct Linux equivalent. It is useful for build notifications, long-running script completion alerts, or generating quick voice-over audio files without additional software.
say "Hello, world" # speak text
say -v ? # list available voices
say -v Samantha "macOS is great" # use specific voice
say -r 180 "fast speech" # words per minute
say -f script.txt # read from file
say -o output.aiff "record this" # save to audio file
Output: (none — exits 0 on success)
Processes
macOS uses a BSD-derived ps; the column layout and flags differ slightly from GNU ps on Linux, but ps aux works on both. For interactive monitoring, top is available by default and Activity Monitor provides the GUI equivalent — PIDs are shared, so you can identify a process in the terminal and locate it in Activity Monitor (or vice versa) by PID.
ps aux # all processes
ps aux | grep python # filter by name
top # interactive process viewer
htop # better top (brew install htop)
kill PID # send SIGTERM
kill -9 PID # send SIGKILL (force)
killall "App Name" # kill by name
pkill -f pattern # kill by pattern match
lsof -i :8080 # what process is on port 8080
lsof -p PID # files open by PID
lsof +D /path # processes using a directory
# Activity Monitor from terminal
sudo fs_usage PID # file system usage
sudo dtrace -n 'syscall:::entry { @[execname] = count(); }' # syscall stats
Output: (none — exits 0 on success)
System info
sw_vers is the macOS equivalent of /etc/os-release on Linux, reporting the product name, version, and build number. system_profiler gives deep hardware and software detail (similar to dmidecode on Linux); use sysctl for kernel tunables and hardware counters. On Apple Silicon, uname -m returns arm64.
sw_vers # macOS version
sw_vers -productVersion # e.g. 15.4.1
uname -a # kernel info
hostname # computer name
scutil --get ComputerName # friendly computer name
scutil --get LocalHostName # local hostname
system_profiler SPHardwareDataType # hardware overview
system_profiler SPSoftwareDataType # software overview
sysctl -n hw.physicalcpu # physical CPU count
sysctl -n hw.logicalcpu # logical CPU count (threads)
sysctl -n hw.memsize # RAM in bytes
sysctl -n machdep.cpu.brand_string # CPU model name
# Architecture
uname -m # arm64 (Apple Silicon) or x86_64 (Intel)
arch # same
Output (sw_vers):
ProductName: macOS
ProductVersion: 15.4.1
BuildVersion: 24E263
Output (scutil --get ComputerName):
Jays-MacBook-Pro
Output (sysctl -n hw.logicalcpu):
10
Output (sysctl -n hw.memsize):
17179869184
Output (system_profiler SPHardwareDataType):
Hardware:
Hardware Overview:
Model Name: MacBook Pro
Model Identifier: Mac14,9
Model Number: MNW93LL/A
Chip: Apple M2 Pro
Total Number of Cores: 10 (6 performance and 4 efficiency)
Memory: 16 GB
System Firmware Version: 10151.121.1
OS Loader Version: 10151.121.1
Serial Number (system): XXXXXXXXXXX
Hardware UUID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Provisioning UDID: XXXXXXXX-XXXXXXXXXXXXXXXX
Activation Lock Status: Enabled
Homebrew
Homebrew is the de-facto package manager for macOS (and works on Linux too). Use brew install for CLI formulae and brew install --cask for GUI apps. The standard maintenance workflow is brew update (fetch new formula definitions) → brew upgrade (install newer versions) → brew cleanup (delete old cached downloads) → brew doctor (diagnose problems).
# Install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install ripgrep # install a formula
brew install --cask firefox # install a GUI app
brew uninstall ripgrep # remove
brew upgrade # upgrade all
brew upgrade ripgrep # upgrade specific
brew update # update Homebrew itself
brew list # installed formulae
brew list --cask # installed casks
brew info ripgrep # info about a package
brew search grep # search packages
brew outdated # packages with updates
brew doctor # diagnose issues
brew cleanup # remove old versions
brew deps --tree ripgrep # dependency tree
brew services list # managed services
brew services start postgresql # start a service
brew services stop postgresql # stop
brew services restart postgresql # restart
Output: (none — exits 0 on success)
Networking
macOS uses BSD ifconfig rather than the Linux ip command; networksetup is the preferred macOS-native tool for scripting network configuration. DNS is managed by mDNSResponder rather than systemd-resolved, so the cache flush command is different from Linux.
ifconfig # network interfaces (legacy)
networksetup -listallnetworkservices # list interfaces
networksetup -getinfo Wi-Fi # IP, subnet, gateway for Wi-Fi
ipconfig getifaddr en0 # IP of interface en0
ipconfig getifaddr en1 # IP of interface en1 (Wi-Fi)
curl ifconfig.me # public IP
ping -c 4 google.com # 4 ping packets
traceroute google.com # route tracing
nslookup github.com # DNS lookup
dig github.com # detailed DNS
host github.com # simple DNS
netstat -an | grep LISTEN # listening ports
lsof -i -P | grep LISTEN # listening ports with process names
lsof -i tcp:443 # what's on port 443
# Wi-Fi (airport was removed in macOS 14.4 — use wdutil)
sudo wdutil info # Wi-Fi diagnostics dump (replacement for airport -I)
networksetup -getairportnetwork en0 # current SSID — returns <redacted> on Sonoma+ without Location Services
networksetup -setairportpower en0 off # turn Wi-Fi off
networksetup -setairportpower en0 on # turn Wi-Fi on
# Note: as of macOS Sonoma 14, SSID/BSSID are redacted from CLI tools
# (airport, ioreg, networksetup, system_profiler, wdutil) unless the
# invoking app holds Location Services permission. macOS Tahoe 26 retains
# this restriction.
# DNS flush
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder
Output (networksetup -listallnetworkservices):
An asterisk (*) denotes that a network service is disabled.
Ethernet
Wi-Fi
iPhone USB
Bluetooth PAN
Thunderbolt Bridge
Output (ifconfig en0):
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=6463<RXCSUM,TXCSUM,TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
ether a8:66:7f:1b:3e:02
inet6 fe80::1c7a:4f2d:3a8b:c1e9%en0 prefixlen 64 secured scopeid 0x4
inet 192.168.1.42 netmask 0xffffff00 broadcast 192.168.1.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect (1000baseT <full-duplex>)
status: active
Output (lsof -i :80):
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 812 root 6u IPv4 0xa3f2d1b8c0e3d000 0t0 TCP *:http (LISTEN)
nginx 813 _www 6u IPv4 0xa3f2d1b8c0e3d000 0t0 TCP *:http (LISTEN)
diskutil
diskutil is the macOS command-line front-end to Disk Utility — use it to list, format, mount, unmount, and repair disks and volumes. On Apple Silicon, the internal disk is typically APFS with multiple synthesized volumes; diskutil list shows both physical disks (/dev/disk0) and synthesized containers (/dev/disk3).
diskutil list # all disks and partitions
diskutil info disk0 # info for disk0
diskutil info / # info for root volume
diskutil eraseDisk APFS "MyDisk" disk2 # erase to APFS
diskutil eraseVolume ExFAT "USB" disk2s1 # erase a volume
diskutil mount disk2s1 # mount a volume
diskutil unmount disk2s1 # unmount a volume
diskutil eject disk2 # eject removable disk
# Verify / repair
diskutil verifyVolume /
diskutil repairVolume /
# APFS
diskutil apfs list # APFS containers and volumes
diskutil apfs addVolume disk3s1 APFS "Scratch" # add APFS volume
Output (diskutil list):
/dev/disk0 (internal):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *512.1 GB disk0
1: Apple_APFS_ISC Container disk1 524.3 MB disk0s1
2: Apple_APFS Container disk3 494.4 GB disk0s2
3: Apple_APFS_Recovery Container disk2 5.4 GB disk0s3
/dev/disk3 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: Apple_APFS_Container disk3 0 B disk3
1: Apple_APFS Macintosh HD 460.4 GB disk3s1
2: Apple_APFS Preboot 5.6 GB disk3s2
3: Apple_APFS Recovery 908.6 MB disk3s3
4: Apple_APFS Data 27.5 GB disk3s5
/dev/disk4 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *128.0 GB disk4
1: Apple_APFS USB-APFS 128.0 GB disk4s1
defaults (preference system)
defaults reads and writes macOS user preference plists stored in ~/Library/Preferences/. It is the scripting interface to settings that are otherwise only accessible via System Settings GUI. Many settings require a killall <App> after writing to take effect; some (like key-repeat rates) require a log-out/log-in cycle.
defaults read # dump ALL user defaults
defaults read com.apple.finder # read Finder prefs
defaults read com.apple.dock # read Dock prefs
defaults write com.apple.dock autohide -bool true # auto-hide dock
defaults write com.apple.dock tilesize -int 36 # dock icon size
defaults write com.apple.dock orientation -string left # dock on left
killall Dock # apply dock changes
defaults write com.apple.screensaver askForPasswordDelay -int 0 # lock immediately
# Key repeat
defaults write -g InitialKeyRepeat -int 15 # 15 = ~225ms
defaults write -g KeyRepeat -int 2 # 2 = ~30ms
# Log out / in to apply
defaults delete com.apple.dock # reset Dock to factory
Output (defaults read com.apple.dock):
{
autohide = 1;
"autohide-delay" = "0.5";
"autohide-time-modifier" = 1;
contents = (…);
largesize = 128;
launchanim = 1;
magnification = 0;
mineffect = genie;
minimize-to-application = 0;
orientation = bottom;
showAppExposeGestureEnabled = 0;
"show-process-indicators" = 1;
"show-recents" = 1;
tilesize = 48;
version = 1;
}
launchctl & services
launchd is the macOS init and service management system — it replaces systemd, cron, init, and inetd in one daemon. launchctl is its command-line interface. Services are defined as plist files in well-known directories: user agents (~/Library/LaunchAgents/) run when the user is logged in; system daemons (/Library/LaunchDaemons/) run as root at boot. Use bootstrap/bootout (macOS 10.11+) in preference to the legacy load/unload subcommands.
launchctl list # running launch agents/daemons
launchctl list | grep com.apple # Apple services only
# Load / unload a plist
launchctl load ~/Library/LaunchAgents/com.example.agent.plist
launchctl unload ~/Library/LaunchAgents/com.example.agent.plist
# Modern bootstrap (macOS 10.11+)
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.example.agent.plist
launchctl bootout gui/$(id -u)/com.example.agent
# Service locations
# ~/Library/LaunchAgents/ user agents (run when user logged in)
# /Library/LaunchAgents/ system agents (any logged-in user)
# /Library/LaunchDaemons/ system daemons (root, no GUI)
# /System/Library/LaunchDaemons/ Apple daemons (don't touch)
Output (launchctl list — first 6 lines):
PID Status Label
812 0 com.apple.audio.coreaudiod
- 0 com.apple.mdworker.shared
- 0 com.apple.parsecd
4201 0 com.apple.Spotlight
- 0 com.apple.coreduetd
…
Security & permissions
macOS layered security adds several concepts beyond standard Unix permissions: Gatekeeper (spctl) blocks unsigned or unnotarized apps; quarantine extended attributes (com.apple.quarantine) are attached by the OS to downloaded files; codesign verifies or signs binaries. xattr is the standard tool to inspect and strip these attributes when Gatekeeper blocks a legitimate app.
chmod +x script.sh # make executable
chmod 644 file.txt # rw-r--r--
chmod -R 755 dir/ # recursive
chown user:group file # change owner
sudo chown -R $(whoami) /usr/local # take ownership
# Extended attributes & quarantine
xattr -l file.dmg # list extended attributes
xattr -d com.apple.quarantine file.dmg # remove quarantine flag
xattr -cr ./app.app # clear all xattrs recursively
# Gatekeeper
spctl --assess --type exec app.app # check Gatekeeper status
sudo spctl --master-disable # disable Gatekeeper (not recommended)
sudo spctl --master-enable # re-enable Gatekeeper
# Keychain
security find-internet-password -s github.com # find stored password
security find-generic-password -s "My Service" -w # get password value
# File Vault
fdesetup status # FileVault status
Output: (none — exits 0 on success)
Archives & compression
macOS includes BSD tar, which supports the same -czf/-xzf flags as GNU tar. Prefer ditto over cp -R when copying app bundles or directories that contain resource forks and extended attributes — ditto preserves Mac-specific metadata that plain cp can drop. Use ditto -ck to create zip archives that retain that metadata when shared with other Macs.
# zip
zip archive.zip file1 file2 # create zip
zip -r archive.zip dir/ # zip directory
unzip archive.zip # extract
unzip -l archive.zip # list contents
# tar
tar -czf archive.tar.gz dir/ # create gzip tar
tar -xzf archive.tar.gz # extract gzip tar
tar -cjf archive.tar.bz2 dir/ # create bzip2 tar
tar -xjf archive.tar.bz2 # extract bzip2
tar -tf archive.tar.gz # list contents
tar -xzf archive.tar.gz -C /dest/ # extract to specific dir
# ditto (macOS-native, preserves resource forks)
ditto src/ dst/ # copy preserving metadata
ditto -ck --sequesterRsrc dir/ archive.zip # create zip with Mac metadata
ditto -xk archive.zip dst/ # extract zip preserving Mac metadata
Output: (none — exits 0 on success)
Text & search
macOS ships with BSD grep, awk, and sed rather than GNU versions. The most common trap: BSD sed -i requires an explicit backup suffix (even an empty one: sed -i '' ...), whereas GNU sed -i accepts no suffix. Install grep and gnu-sed via Homebrew to get GNU behaviour when needed.
grep -r "pattern" . # recursive search
grep -rn "pattern" . --include="*.py" # with line numbers, filter ext
grep -rl "pattern" . # list files only
find . -name "*.log" -mtime -7 # files modified last 7 days
find . -name "*.DS_Store" -delete # remove .DS_Store files
find . -type f -size +10M # files over 10 MB
mdfind "query" # Spotlight search from terminal
mdfind -name "report.pdf" # find by filename via Spotlight
mdfind "kMDItemContentType == 'public.png'" # find by UTI
# awk, sed, sort, uniq — same as Linux
awk '{print $1}' file.txt
sed -i '' 's/old/new/g' file.txt # macOS sed requires '' after -i
sort -u file.txt # sort + deduplicate
Output: (none — exits 0 on success)
Spotlight & metadata
Spotlight indexes file content and metadata into a database queryable via mdfind — faster than find for name and content searches across the filesystem. mdls exposes the full set of indexed metadata attributes for a single file (content type, creation date, author, GPS coordinates for photos, etc.). mdutil controls whether Spotlight indexes a given volume, which is useful for disabling indexing on external drives.
mdls file.pdf # all metadata for a file
mdls -name kMDItemContentType file.pdf # specific attribute
# Index control
sudo mdutil -i on / # enable Spotlight indexing
sudo mdutil -i off /Volumes/USB # disable for a volume
sudo mdutil -E / # erase and rebuild index
mdutil -s / # indexing status
Output (mdls filename — e.g. mdls report.pdf):
report.pdf
kMDItemContentCreationDate = 2026-03-15 09:42:11 +0000
kMDItemContentModificationDate = 2026-04-10 14:07:55 +0000
kMDItemContentType = "com.adobe.pdf"
kMDItemContentTypeTree = (
"com.adobe.pdf",
"public.data",
"public.item",
"public.content"
)
kMDItemDisplayName = "report.pdf"
kMDItemFSCreationDate = 2026-03-15 09:42:11 +0000
kMDItemFSName = "report.pdf"
kMDItemFSSize = 204812
kMDItemKind = "PDF Document"
kMDItemLastUsedDate = 2026-04-24 11:23:00 +0000
kMDItemPageHeight = 792
kMDItemPageWidth = 612
kMDItemTitle = "Q1 Report"
Output (mdfind "query" — e.g. mdfind "kMDItemKind == 'PDF Document'"):
/Users/alice/Documents/report.pdf
/Users/alice/Downloads/invoice_2026.pdf
/Users/alice/Desktop/notes.pdf
/Users/alice/projects/docs/spec.pdf
Screenshots (command line)
screencapture is the CLI behind macOS's built-in screenshot shortcuts. It supports full screen, window selection, region capture, and direct clipboard output, making it suitable for scripted screenshot workflows and automated UI testing without third-party tools.
screencapture -x screen.png # screenshot, no shutter sound
screencapture -T 5 delayed.png # 5-second delay
screencapture -w window.png # click to capture a window
screencapture -s selection.png # drag to select region
screencapture -c # capture to clipboard
screencapture -t jpg output.jpg # JPEG format
screencapture -R 0,0,1280,720 region.png # specific region (x,y,w,h)
Output: (none — exits 0 on success)
Power management
pmset is the macOS equivalent of Linux power-management tunables — it controls sleep, standby, and hibernation behaviour. caffeinate is a lighter-weight tool that asserts a power-management assertion to prevent sleep for the duration of a command or a fixed time, without permanently changing system settings.
pmset -g # current power settings
pmset -g assertions # power assertions (what's preventing sleep)
pmset -g log | tail -50 # recent power events
caffeinate # prevent sleep (ctrl-C to stop)
caffeinate -t 3600 # prevent sleep for 1 hour
caffeinate -i make # prevent sleep while command runs
caffeinate -d # prevent display sleep specifically
sudo pmset sleep 0 # disable sleep (plugged in)
sudo pmset -b sleep 10 # sleep after 10 min on battery
# Shutdown / restart
sudo shutdown -h now # shutdown immediately
sudo shutdown -r now # restart immediately
sudo shutdown -h +60 # shutdown in 60 minutes
Output (pmset -g):
System-wide power settings:
Currently in use:
standbydelaylow 10800
standby 1
halfdim 1
hibernatefile /var/vm/sleepimage
proximitywake 1
autorestart 0
disksleep 10
standbydelayhigh 86400
sleep 1 (sleep prevented by coreaudiod)
hibernatemode 3
highstandbythreshold 50
displaysleep 2
tcpkeepalive 1
ttyskeepawake 1
darkwakes 1
gpuswitch 2
womp 0
Useful macOS-specific tools
# System events
osascript -e 'display notification "Done!" with title "Build"' # notification
osascript -e 'tell application "Finder" to empty trash' # empty trash
# Pasteboard / Universal Clipboard
pbcopy; pbpaste # see Clipboard section above
# Quick Look from terminal
qlmanage -p file.png # preview a file
# System sound
afplay /System/Library/Sounds/Ping.aiff # play a system sound
afinfo /System/Library/Sounds/Ping.aiff # file info
# Sharing
networksetup -setnetworkserviceenabled "Ethernet" on # enable interface
scutil --set ComputerName "MyMac" # rename computer
# xcode cli tools
xcode-select --install # install Command Line Tools
xcode-select -p # path to active dev tools
xcrun --find clang # find a specific tool
Output: (none — exits 0 on success)
.DS_Store & housekeeping
macOS Finder writes .DS_Store files into every directory it visits, storing view options and icon positions. These files are harmless locally but pollute git repositories and network shares. The defaults write com.apple.desktopservices DSDontWriteNetworkStores true setting prevents Finder from creating them on mounted network volumes; a .gitignore entry suppresses them from version control.
# Remove .DS_Store everywhere
find . -name ".DS_Store" -delete
# Prevent .DS_Store on network shares
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
# Clear icon cache
sudo find /private/var/folders -name "com.apple.dock.iconcache" -delete
sudo find /private/var/folders -name "com.apple.iconservices" -delete
killall Dock
# Clean up system caches (careful)
sudo periodic daily weekly monthly # run maintenance scripts
Output: (none — exits 0 on success)
Common recipes
# Copy SSH key to clipboard
cat ~/.ssh/id_ed25519.pub | pbcopy
# List largest files in current directory
du -sh * | sort -rh | head -10
# Kill process on port 3000
lsof -ti:3000 | xargs kill -9
# Watch a file for changes
fswatch -o file.txt | xargs -n1 -I{} echo "changed"
# Recursively fix permissions
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
# Monthly disk usage report
du -sh ~/Documents ~/Downloads ~/Desktop ~/Movies ~/Music ~/Pictures
# Remove quarantine from downloaded app
xattr -dr com.apple.quarantine /Applications/MyApp.app
# Check if a port is open
nc -zv google.com 443
# Flush DNS cache
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder
# Convert HEIC to JPEG (requires sips)
for f in *.heic; do sips -s format jpeg "$f" --out "${f%.heic}.jpg"; done
Output: (none — exits 0 on success)
Sources
References consulted while writing and updating this article. Links open in a new tab.
- What's new for enterprise in macOS Tahoe 26 — Apple Support — Apple's enterprise changelog for macOS 26 (Tahoe), source for the wdutil/airport status and SSID-redaction notes.
- wifi-unredactor — noperator/wifi-unredactor on GitHub — Documents the SSID-redaction behaviour introduced in macOS Sonoma and how to opt out for debugging.
- Goodbye, airport! — Intuitibits — Confirms the
airportbinary removal in macOS 14.4 and the recommendedwdutilreplacement. - wdutil reference — ss64.com — Flag-by-flag reference for the wdutil replacement command used throughout the Wi-Fi section.