The open Command on Mac: Launch Anything From Terminal
The open command is the bridge between Terminal and the rest of your Mac. Point it at a file, folder, app, or URL and macOS handles it exactly as if you'd double-clicked — same default apps, same behavior. It's the first command worth learning because it makes every other Terminal session less of a dead end.
Start with open . — the two characters you'll use daily
The dot means "the folder I'm standing in," so this pops the current Terminal location open as a Finder window:
# open the current folder in Finder
open .
# open any folder by path
open ~/Downloads
# open a file with its default app
open budget-2026.xlsx
That last form respects your system defaults: a .pdf goes to Preview (or whatever you've set), an .html file to your default browser, and so on. If open picks the wrong app, that's a default-app problem, not an open problem — see how to change the default app for a file type.
Two details worth knowing early. open expands ~ the same way the shell does, so open ~/Library takes you straight into a folder Finder normally hides — often the fastest way in. And if the path you give doesn't exist, open says so plainly instead of failing silently, which makes it a quick way to confirm that a script's output actually landed where you expected.
Pick which app handles the file
Three flags override the default when you want a specific app just this once:
# -a: open with a specific app (use the app's name)
open -a Preview screenshot.png
open -a "Google Chrome" https://trymainspring.com
# -e: force TextEdit, handy for peeking at config files
open -e ~/.zshrc
# -t: open in your default text editor
open -t notes.md
The -a flag also works with no file at all — open -a Calculator simply launches the app. Quote names that contain spaces, and use the name as it appears in the Applications folder. If open can't find the app you named — a typo, or an app that lives somewhere unusual — it reports "Unable to find application" and does nothing, so the worst case is a harmless error message.
Because these flags affect only that one launch, there's nothing to undo: the next double-click uses your normal default again. That makes -a the polite way to test an app you're evaluating — say, opening the same image in three different editors — without committing to any of them as the default.
Reveal, URLs, and batches
A few more flags cover the rest of what open does well:
open -R file.pdf— reveal the file: instead of launching it, Finder opens with the file selected. Perfect after a script generates output somewhere deep.open https://example.com— URLs launch in your default browser;mailto:links open a new message in your default mail app.open *.png— wildcards work, so this opens every PNG in the folder in Preview as one batch. Great for a quick flip-through of screenshots.open -n -a Calculator—-nforces a new instance even if the app is already running. Two Calculator windows, two timers, two of anything.open -g file.pdf— opens in the background without stealing focus from Terminal, so you can keep typing.
Everything composes: open -g -a Preview *.jpg loads a folder of photos into Preview while you stay in the Terminal. And because open returns immediately rather than waiting for the app to quit, it never blocks a script that calls it — which makes it a natural last line in small automations: generate a report, then open it, or open -R it so Finder shows you the result without launching anything heavier.
The reverse trip: Finder to Terminal
open . takes you from Terminal to Finder. macOS has the opposite direction built in too — a "New Terminal at Folder" service that opens a shell already cd'd into whatever folder you right-click. Set it up once in our guide to opening a Terminal window at any folder, and the round trip is complete.
While you're getting comfortable in the Terminal, Mainspring turns 90+ hidden macOS settings into labelled, reversible toggles — one click on, one click off, no syntax to remember.
Try Mainspring free →Signed & notarized by Apple · 1-day free trial · $29 once