Skip to content

Open any folder from the Terminal app in a Finder on macOS

Published:

2 min read

Often, I struggle or want to open the current directory I am working from the Terminal app to the Finder window on macOS.

I have been a macOS user for almost eight years now, and it never occurred to me that I couldn’t open the current location from the Terminal app. Until recently, a frustration point led me to find the solution. Again, though, I am surprised by its simplicity.

To open the current working directory in the Finder window, use the following command:

open .

The open command opens a file or a folder. It exists on the macOS.

You can do more with this command. The / argument opens the root directory.

open /

A specific directory is also allowed:

open ~/Desktop

Using the option R, you can locate a specific file or folder in the Finder:

open -R /blog

Opening files

There are more things that the open command can do. It can open files. For example, to open a markdown file in the default editor or IDE:

open ./blog/mm-yy/your-file-name.md

The above command opens the markdown file in the Xcode. You can pass the -t option to open in the file in a text editor.

open -t ./blog/mm-yy/your-file-name.md

Opening URLs

It can do more than open files and folders. It can also open a URL in the default web browser set up on your machine:

Use option a to override the default web browser and specify a different one.

open -a Safari https://www.google.com

Previous Post
How to add opacity to a Pressable component in React Native
Next Post
How to push local git tag to remote repository on GitHub

I'm a software developer and technical writer. On this blog, I share my learnings about both fields. Recently, I have begun exploring other topics, so don't be surprised if you find something new here.

Currently, working as a documentation lead at Expo.