How to Open Any Folder from the Mac Terminal

A collection of folders.

The standard way to open any directory within macOS is to open a Finder window and use it to navigate to a specific location on your hard drive. There’s also another way to open folders: use the Terminal. It may not be something you use every day unless you’re a developer, but the power is there if you need to call on it.

As such, this post will show you how to open any folder from the macOS Terminal. We also show you how to create a custom shortcut to carry out this command.

Also read: How to Customize Your Mac’s Terminal for Better Productivity

Why You’d Want to Open a Folder From the Mac Terminal

As we noted, the preferred way of opening a folder is by using Finder. This is a Graphical User Interface (GUI), and it’s macOS’s directory navigation de jure. But it’s not the only way to access files or folders within macOS.

We admit, using the Terminal to open folders isn’t a natural way to get around macOS. Though, you’ll find it will come in handy in the following situations:

  • If you’re a command line user, it may be something you have in your toolbox.
  • Developing for Mac often means working within the Terminal. If this is the case, it may be the path of least resistance to stay inside the Terminal as much as possible.
  • If you’re in a rare situation where macOS is acting as server software, you may only be able to use the Terminal to navigate the Operating System (OS).

Given the above, it’s easy to see why you may want to have the knowledge. Next, we show you how to get the job done.

How to Open Any Folder from the Mac Terminal

To begin, you’ll need to open the Terminal. This can be found either through the “Application -> Utilities” folder

Opening the Terminal in macOS.

or by typing “Terminal” in Spotlight. Once it’s open, you won’t need any dependencies to open any folder from the Mac Terminal. You’ll only need the open command. The general syntax is as follows:

open /path/to/Directory/

For example, to open the Pictures folder, you’d use the following:

open /Users/<username>/Pictures

This will open the Pictures folder in a Finder window, which you can then use to access its files.

Opening the Pictures folder from the macOS Terminal.

There are a bunch of other short commands you can use to access specific folders. For example:

  • To open the Root directory, use open /.
  • For your Home folder (i.e. the folder containing Desktop, Documents, and other folders specific to the user), type open ~.
  • To open the current working folder within Finder, use open ..

To touch on this last point further, you may be navigating your files using the Terminal and have a need to open the folder you’re in.

Opening the current working directory in the Finder.

While the commands so far open specific folders, you can also launch (and update) applications from the Terminal without using Finder. For example, to open Safari, type open /Applications/Safari.app.

Of course, you’re able to replace Safari with any app on your system as long as you know its file name.

Open a Folder in Terminal from a Shortcut Menu

It may be that you want to reverse the situation and open a Finder directory in the Terminal. In other words, make it the current working directory. You can do this by adding a right-click shortcut.

To do this, head to System “Preferences -> Keyboard.”

The Keyboard System Preferences pane.

Next, navigate to the Shortcuts tab. Here, select the Services menu and scroll down to find “New Terminal at Folder.”

Selecting the New Terminal at Folder option.

If you select any folder within Finder, open the Services menu from the Toolbar and choose “New Terminal at Folder.”

Opening a Finder folder in the Terminal.

This is going to be ideal if you often switch between a GUI and the Terminal.

In Summary

The Mac Terminal isn’t something you’ll encounter often. In contrast, a developer or sysadmin might spend most of their time using a Terminal app. Given this, opening a folder is a basic task that can keep you on the command line as long as possible. All you need is the open command and the path to your folder.

If you’re looking for more to do with the Terminal, we’ve looked at searching the Web without a browser, direct from the command line. Will this inspire you to use the Mac Terminal more? Share your thoughts in the comments section below!

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Tom Rankin

Tom Rankin is a quality content writer for WordPress, tech, and small businesses. When he's not putting fingers to keyboard, he can be found taking photographs, writing music, playing computer games, and talking in the third-person.