Tip 325Start GUI Apps from the Command Line

Sometimes it’s necessary to start GUI apps from within a Terminal window. Here’s how that can be done.

Opening Finder

To start a Finder window displaying the location you’re currently browsing at the command prompt, just type the following:

 
open .

That’s open followed by a period. Any path will work here, along with relative paths: open ../ opens the parent of the folder currently being browsed, for example, while open / opens a Finder window displaying the root of the filesystem.

Note that the Terminal window can now be closed without affecting the Finder window.

Opening Files

The open command could also be described as the command-line equivalent of double-clicking a file. Any file specified after ...

Get Mac Kung Fu, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.