Useful built-in macOS command-line utilities

Enhanced use of open and Finder integration

  • open -n launches a new instance of an app (e.g., Preview) to view the same file twice.
  • open -a <App> <file>, open -b <bundle_id> <file>, and open -R <file> let you target non-default apps, use stable bundle IDs, or reveal files in Finder.
  • open . (or open -a Finder .) opens the current directory in Finder.
  • Some note open sometimes brings apps to foreground; others point to -g for background and possible links to Terminal’s “secure keyboard entry.”
  • Finder path tricks: drag proxy icons into Terminal, copy a file in Finder then paste its path into Terminal, or use AppleScript to cd into the frontmost Finder window.

Sleep, power, and battery management

  • caffeinate is widely praised (-disu, -w <pid>, wrapping long-running commands). Some say it doesn’t keep chat apps “active” even with -u.
  • GUI alternatives like Amphetamine and KeepingYouAwake are mentioned.
  • pmset and powermetrics are used for power settings and diagnosing battery drain, sometimes combined with caffeinate. Reliability of scheduled wake is described as mixed.

Media and file format tools

  • sips is used for batch image conversion and resizing; can convert from (but not to) WebP. It hides a JS/Canvas-like API.
  • afconvert and afplay handle audio conversion/playback, with repeated claims that Apple’s AAC encoder is higher quality than many others.
  • Long subthread debates AAC vs MP3 vs Opus/FLAC, encoder quality, and psychoacoustic models, with some preferring Opus/FLAC and others emphasizing AAC’s compatibility and quality.
  • say is used for notifications, pranks, scripting voiceovers, and has quirks (roman numerals, custom voices). hear is mentioned as a third-party speech-recognition CLI.

Clipboard and JSON/text utilities

  • pbcopy/pbpaste are heavily used; people mirror them on Linux/WSL and via OSC52 for remote sessions.
  • A common pattern: pbpaste | jq | pbcopy to pretty-print JSON.
  • Cross-platform helper functions abstract differences between macOS and Linux clipboards.

Search, metadata, and indexing

  • mdfind is preferred over locate (not enabled by default), sometimes aliased to match locate behavior.
  • Example pattern: embedding unique IDs in files and using mdfind + hashes to rediscover directories.
  • mdls is used to inspect file metadata (e.g., photo GPS data).
  • plutil converts and queries plist files and can parse JSON, though some say built-in jq (macOS 15+) supersedes parts of this.

Networking and diagnostics

  • Hidden airport -s scans Wi‑Fi; users note it is deprecated in favor of wdutil. Capability parity (e.g., monitor mode) with airport is unclear.
  • networkQuality runs bandwidth/latency tests. Some find it underestimates uplink vs other tools; -s flag gives more comparable sequential tests.
  • Other mentioned tools: nc (netcat), fs_usage (I/O tracing), system_profiler, wdutil, and third-party Bluetooth diagnostics gaps.

Filesystem, backup, and storage tools

  • diskutil is praised as more reliable than Disk Utility GUI. pdisk is called obsolete except for legacy Apple Partition Map.
  • tmutil is cited for Time Machine control.
  • Debates around APFS complexity, Time Machine regressions, and Apple’s focus shifting toward iCloud.
  • Some recommend dot_clean -m for cleaning metadata files from USB drives.

UI tweaks and defaults

  • defaults write is used to tweak many macOS settings; example: changing Launchpad grid size then restarting Dock.
  • Tools like TinkerTool provide a GUI over hidden defaults.
  • Terminal.app’s “New Remote Connection…” and Finder’s show-hidden-files toggle (Shift+Cmd+.) are highlighted as underused UI features.

Keychain, security, and passwords

  • The security CLI is appreciated for Keychain access, but one commenter warns of “sharp edges” vs using password managers with their own CLIs; specifics of those issues are not elaborated.
  • Lack of a CLI for iCloud Keychain-stored passwords is seen as a missing piece for scripting secrets.

Cross-platform parallels and third‑party CLIs

  • Linux parallels: xdg-open, caffeine/caffeinate packages, clipboard shims on WSL.
  • Popular non-built-in tools mentioned: fzf, ripgrep, lsd, atuin, mtr, httpie, various Mac-specific lists (Terminal Trove, personal catalogs).

Debates, annoyances, and meta points

  • .DS_Store sparks debate: some see it as ugly clutter or even a “bug”; others defend it as necessary, portable metadata, with alternatives (xattrs, central DB) having tradeoffs.
  • Complaints about apps hijacking file associations (e.g., JSON to Xcode, directories to VSCode on Linux).
  • Critique that some modern Apple utilities rewrites (often in Swift) feel slower/buggier; others argue the causes may be broader than language choice.
  • Some commentary on terminology: these tools are Unix utilities, not “bash commands.”