open — Open Files, Folders and Apps from the Terminal
macOS command to open files, folders, URLs and apps from the terminal with the default or a specified app – the bridge between terminal and Finder/GUI.
With open you launch files, folders, apps and URLs straight from the terminal – each through the default association that macOS would otherwise use on a double-click in Finder. The command is the bridge between terminal and GUI: you type a command and macOS opens the matching program, exactly as if you had clicked the item in Finder. Options like -a, -R and -b let you control which app launches and how it behaves. This guide walks you through the calls you reach for daily.
Open Files & Directories
open <file> — Open a file with its default application.
open document.pdfopen . — Open the current directory in Finder.
open .open <directory> — Open a directory in Finder.
open ~/Downloadsopen -R <file> — Reveal a file in Finder (highlight it).
open -R ~/Documents/report.pdfopen <file1> <file2> — Open multiple files.
open image1.png image2.png image3.pngOpen with Specific App
open -a '<app>' <file> — Open a file with a specific application.
open -a 'Visual Studio Code' project/open -a '<app>' — Launch an application.
open -a 'Safari'open -e <file> — Open a file in TextEdit.
open -e notes.txtopen -t <file> — Open a file in the default text editor.
open -t config.yamlopen -b <bundle-id> <file> — Open with an app specified by bundle identifier.
open -b com.microsoft.VSCode .Open URLs
open <url> — Open a URL in the default browser.
open https://example.comopen -a '<browser>' <url> — Open a URL in a specific browser.
open -a 'Firefox' https://example.comopen mailto:<email> — Compose an email in the default mail app.
open mailto:user@example.comopen 'x-apple.systempreferences:<pane>' — Open a specific System Settings pane.
open 'x-apple.systempreferences:com.apple.Network-Settings.extension'Options
open -n -a '<app>' — Open a new instance of an application.
open -n -a 'Safari'open -g <file> — Open without bringing the app to the foreground.
open -g document.pdfopen -W <file> — Wait for the application to close before returning.
open -W document.txtopen -F -a '<app>' — Open app fresh (don't restore windows).
open -F -a 'Safari' Conclusion
open is the small connective tissue that joins terminal workflows with the macOS graphical interface: open . jumps from the current directory straight into Finder, open -R highlights a file there, and open -a launches any app you like – ideal in scripts and aliases. Because open understands schemes like https:, mailto: and x-apple.systempreferences:, you can drive browsers, mail and System Settings from a single line as well. The command exists only on macOS – on Linux its counterpart is xdg-open, on Windows start.
Further Reading
- open – ss64.com – detailed reference of every option
- open(1) – macOS Man Page – official man page description
Related Commands
- caffeinate – prevent the Mac from going to sleep
- defaults – read and write macOS user preferences
- diskutil – manage disks, partitions and volumes