Why can't I pipe `pwd` to `open` on macOS?

The open utility on macOS does not read from standard input, but take its arguments from the command line.

To open the current working directory, you would have to say

$ open "$( pwd )"

or

$ open "$PWD"

or simply

$ open .

as pointed out in the comments below.

With the -f flag, open can be made to read from standard input, but only to open whatever it receives in the default text editor.


I don't have a Mac so I can't test it, but the solution should be something like:

open "`pwd`"

Not all programs take their input from stdin which would be necessary for the pipe to work.


The other answers are totally correct. If you want an easy shorthand, you can do as @fd0 proposed, and just use

open .

to open the current directory. The current directory is named . (a single dot) in Unix, the parent directory .. (two dots).

Tags:

Macos

Pipe