Skip to main content
coreydaley.dev
Docs menu

Command-line tools built into macOS

Terminal tools every Mac already has: resize photos, search with Spotlight, convert documents, zip like Finder, verify downloads. Tested on macOS 27.

Every Mac comes with dozens of command-line tools that most people never hear of: one resizes and converts photos, one searches with Spotlight, one converts Word documents, one zips folders exactly the way Finder does. You run them in Terminal (in Applications > Utilities) by typing a line and pressing Return. Nothing to install.

I ran the examples in this guide on macOS 27.2 on an Apple silicon Mac, on test files made for the purpose, and the output shown is what came back. The few I didn’t run are marked.

The twelve worth knowing first

ToolWhat it doesExample
sipsResize and convert imagessips -Z 1600 photo.heic -s format jpeg --out photo.jpg
mdfindSpotlight search, including text inside documentsmdfind -onlyin ~/Documents "quarterly report" 2>/dev/null
caffeinateKeep the Mac awake while something runscaffeinate -i ./backup.sh
pbcopy, pbpasteCopy to and paste from the clipboardpbpaste | tr a-z A-Z | pbcopy
textutilConvert txt, rtf, html, docx, odttextutil -convert docx notes.rtf -output notes.docx
sayText to speech, or to an audio filesay -o hello.aiff "Backup finished"
networkQualitySpeed and responsiveness testnetworkQuality -s
dittoCopy and zip the way Finder doesditto -c -k --sequesterRsrc --keepParent Project Project.zip
screencaptureScreenshots from a scriptscreencapture -x -R 0,0,800,600 shot.png
qlmanageQuick Look thumbnails of images, PDFs and documentsmkdir -p thumbs && qlmanage -t -s 256 -o thumbs report.pdf
shasumCheck a download against its published hashshasum -a 256 -c file.dmg.sha256
sw_vers, system_profilerWhich macOS and which Macsw_vers -productVersion

The pages in this guide cover each one with tested examples and the traps:

  • Files and images: sips, textutil, ditto, Apple Archive, qlmanage, checksums and extended attributes.
  • Everyday tools: Spotlight, the clipboard, keeping the Mac awake, speech, screenshots and a network test.
  • System information: macOS and hardware details, disks, logs, property lists and settings, read-only.

Before you start

  • Some tools change files in place. sips without --out and plutil -convert without -o overwrite the original. The examples here always write a new file; try anything else on copies first.
  • Some write nothing without saying much. qlmanage -o thumbs reported “produced one thumbnail” and wrote nothing when the thumbs folder didn’t exist. Check that the output is there.
  • zsh has its own log command. In the default shell, log show fails with “too many arguments”; type /usr/bin/log show instead.
  • A few ask for permission. screencapture needs Screen Recording for Terminal, and osascript scripts that control other apps ask for Automation access the first time. The examples here avoid the second.
  • man explains any tool: man sips. Most tools also print their options when given one they don’t recognize.
  • Automate your Mac: Shortcuts, AppleScript and Automator, which can all run these tools