# Open a File From Terminal on Mac: The open Command

> How to open a file from Terminal on Mac with the open command: in its default app, in a named app, in TextEdit, shown in Finder, or inside the terminal.

Canonical: https://monok.io/blog/open-file-from-terminal-mac.md

[Terminal](https://monok.io/blog/category/terminal)

Nemo · November 7, 2026 · 6 min read

To open a file from Terminal on a Mac, type `open` followed by the file’s path and press Return, for example `open report.pdf`. macOS opens it in the same app a double-click in Finder would use. To pick the app yourself, add `-a` and its name: `open -a Preview report.pdf`.

The `open` command is the bridge between the command line and the rest of macOS. It doesn’t read the file itself. It hands the file to Launch Services, the part of macOS that decides which app opens what, exactly like Finder does.

## Why use Terminal to open a file at all?

You are already in a folder in Terminal, you just ran a script that wrote `output.csv`, and now you want to look at it. Switching to Finder means finding that folder again. Typing `open output.csv` lands on the same file without leaving the keyboard.

It also helps when Finder hides things: files that start with a dot, folders inside app bundles, or paths you only know from an error message.

## What are the most useful open commands?

Every command below runs in the built-in Terminal app, iTerm2, or any other Mac terminal. Run them from the folder the file is in, or give the full path.

| Command | What it does |
|---|---|
| `open file.pdf` | Opens the file in its default app |
| `open -a Preview file.png` | Opens it in a named app |
| `open -e notes.txt` | Opens it in TextEdit |
| `open -t notes.txt` | Opens it in your default text editor |
| `open -R file.pdf` | Reveals it in Finder, selected, without opening it |
| `open .` | Opens the current folder in a Finder window |
| `open https://example.com` | Opens the address in your default browser |
| `open -n -a Preview file.png` | Starts a new copy of the app even if one is running |
| `open -g file.pdf` | Opens it without bringing the app to the front |
| `open -W file.txt` | Waits until you quit the app before the prompt comes back |

You can pass several files at once, and wildcards work too: `open *.png` opens every PNG in the folder.

## How do you open a file in a specific app?

Use `-a` with the app’s name as it appears in the Applications folder, without `.app`:

```
open -a "Visual Studio Code" app.js
open -a TextEdit config.yml
open -a Safari index.html
```

Put the name in quotes when it has spaces. If you see `Unable to find application named`, check the exact spelling in Applications. You can also use the app’s bundle identifier with `-b`, for example `open -b com.apple.TextEdit notes.txt`, which keeps working if an app is renamed.

## How do you handle file names with spaces?

Wrap the path in quotes, or put a backslash before each space:

```
open "Quarterly Report.pdf"
open Quarterly\ Report.pdf
```

An easy way to avoid typos is to let the Mac write the path for you. Type `open ` with a space at the end, then drag the file from Finder into the Terminal window. The full path appears, already escaped. Pressing Tab after the first letters of a name completes it too.

## How do you open a file inside the terminal instead?

`open` always hands the file to another app. To read or edit it without leaving the terminal, use a command-line tool:

- `cat notes.txt` prints the whole file.
- `less notes.txt` shows it a page at a time. Press Space to go down and q to quit.
- `nano notes.txt` edits it in a simple editor. Ctrl+O saves, Ctrl+X quits.
- `vim notes.txt` edits it in Vim. Type `:wq` and Return to save and quit.
- `qlmanage -p photo.jpg` shows a Quick Look preview, the same as pressing Space in Finder.

Most editors also ship a command of their own. VS Code adds `code` once you run “Shell Command: Install ‘code’ command in PATH” from its Command Palette, and then `code .` opens the whole folder.

## Why does open say the file does not exist?

The error `The file /Users/you/report.pdf does not exist.` usually means one of three things:

1. **You are in a different folder.** Run `pwd` to see where you are and `ls` to see what is there. Then `cd` to the right folder or use the full path.
2. **The name has a space or a capital letter you missed.** File names in Terminal are typed exactly. Use Tab completion.
3. **The file is hidden.** Names that start with a dot don’t show in Finder by default; `ls -a` lists them. See [how to show hidden files on Mac](https://monok.io/blog/show-hidden-files-mac).

If you don’t know where the file is at all, find it first: `mdfind -name report.pdf` searches the Spotlight index from the terminal. [How to find a file on Mac](https://monok.io/blog/find-a-file-on-mac) covers the other ways.

## What other Terminal commands go with open?

`open` is one of a handful of commands worth knowing by heart: `cd`, `ls`, `pwd`, `mv`, `cp` and `mdfind` cover most day-to-day work with files. The full list, with what each one does, is in [Mac Terminal commands](https://monok.io/blog/mac-terminal-commands). If you haven’t opened Terminal before, start with [how to open Terminal on Mac](https://monok.io/blog/how-to-open-terminal-on-mac).

## Can the terminal sit next to the file you are working on?

Most of the time you open a file from Terminal because you were doing something in a browser and a terminal at once: reading docs while running a build, checking a page while editing its config. That means two windows, and a lot of Cmd+Tab.

Monok is a small Mac browser with a native terminal built in, as a pane next to the page. Ctrl+`splits a terminal in below the page, running your own login shell, so`open`, `less` and every command above work there the same way. File › Open Folder in Terminal starts one in a folder you pick. Monok is an early preview, and the terminal is native: no web page or JavaScript can reach it. More in [a browser with a built-in terminal](https://monok.io/blog/browser-with-built-in-terminal).

## Next step

Open Terminal, `cd` into a folder you use every day, and run `open -R` on one file to see it land in Finder. If you’d like that terminal next to your pages instead of in another window, [download Monok](https://monok.io/download).

## FAQ

### How do I open a file in Finder from Terminal?

Use `open -R path/to/file`. It opens a Finder window with the file selected, without opening the file. `open .` opens the current folder in Finder.

### How do I open a file with TextEdit from Terminal?

Run `open -e file.txt`. To use whatever text editor you set as the default, run `open -t file.txt` instead.

### How do I open an app from Terminal on Mac?

Run `open -a` followed by the app’s name, for example `open -a Safari`. Without a file, it just launches the app.

### How do I open a file from Terminal with a path that has spaces?

Wrap the path in quotes, like `open "My File.pdf"`, or escape each space with a backslash. Dragging the file into the Terminal window writes the escaped path for you.

### What is the difference between open and cat?

`open` hands the file to an app, the same as a double-click in Finder. `cat` prints the file’s contents in the terminal itself and works only for text.

Early preview · macOS

Monok is a small Mac browser with a native terminal and a file manager.

Magic Bar, tmux-style panes, your own shell and ad blocking built in. Free while in preview.

 [Go to the download](https://monok.io/download)

**About this article.** Written by Nemo, who is building Monok. Performance numbers here are v1 targets unless a post says they were measured, and on what. Spotted something wrong or out of date? [Tell us](mailto:support@monok.io).

More in Terminal

[Terminal](https://monok.io/blog/category/terminal) Nov 5, 2026 · 4 min

## [Best Terminal for Mac: How to Pick One for How You Work](https://monok.io/blog/best-terminal-for-mac)

The best terminal for Mac depends on how you work: Terminal.app, iTerm2, Ghostty, WezTerm, kitty and Alacritty compared on panes, setup and config.

[Terminal](https://monok.io/blog/category/terminal) Nov 2, 2026 · 4 min

## [How to Open Terminal on Mac: 5 Quick Ways](https://monok.io/blog/how-to-open-terminal-on-mac)

How to open Terminal on a Mac in 5 ways: Spotlight, the Utilities folder, the Dock, a folder's right-click menu or a drag, plus a terminal next to the browser.

[Terminal](https://monok.io/blog/category/terminal) Oct 30, 2026 · 4 min

## [Mac Terminal Commands: The Ones Worth Knowing](https://monok.io/blog/mac-terminal-commands)

The Mac Terminal commands worth knowing: moving around, files, searching, Mac-only commands like open, pbcopy and caffeinate, and safe habits for rm and sudo.
