Ledge

How to open Terminal in the current Finder folder on a Mac

The quickest built-in way to open Terminal in the current Finder folder is to Control-click the folder and choose New Terminal at Folder, or to drag the folder onto the Terminal icon in the Dock. Either one opens a new window that is already sitting in that folder, so there is no path to type. If Terminal is open already, type cd and a space, drag the folder into the window and press Return.

Use the New Terminal at Folder service

macOS ships with a Finder service made for exactly this.

  1. In Finder, select the folder you want. It has to be the folder itself, not a file inside it.
  2. Control-click the folder and look near the bottom of the menu for New Terminal at Folder. Depending on how many services your Mac has, it is listed directly or inside a Services submenu.
  3. Choose it. Terminal opens a new window in that folder.

New Terminal Tab at Folder, listed right beside it, does the same thing in a new tab of the Terminal window you already have open.

If neither command appears, it is switched off. Open System Settings > Keyboard, click Keyboard Shortcuts, choose Services, open the Files and Folders group and tick New Terminal at Folder and New Terminal Tab at Folder. While you are there, you can give either one a keyboard shortcut: double-click to the right of its name and press the keys you want.

The catch is that the service acts on a selected folder. Control-click the empty background of a window and it is not offered, which is awkward when the folder you want is the one you are standing in.

Open the folder you are already looking at

Three built-in ways get around that.

  • The path bar. Choose View > Show Path Bar. A strip appears along the bottom of every Finder window showing where you are, with the current folder as the last item. Control-click that last item and choose Open in Terminal. The same works for any folder further up the strip.
  • The title bar icon. Rest the pointer on the folder’s name at the top of the window until a small folder icon appears next to it. That icon stands for the folder itself. Drag it onto the Terminal icon in the Dock. How to drag a file from a window’s title bar covers this icon in more detail.
  • One level up. Press Command-Up Arrow. Finder moves to the enclosing folder and leaves the folder you came from selected, ready for a Control-click and New Terminal at Folder.

Drag the folder to Terminal instead

Dragging is often faster than a menu, and it works in two different ways.

Onto the Dock icon. Drag any folder onto the Terminal icon in the Dock and let go. A new window opens in that folder, and Terminal starts first if it was not running. For this to be practical, Terminal needs to live in the Dock: while it is running, Control-click its Dock icon and choose Options > Keep in Dock.

Into a window you already have. When you have a session going and want to keep its history, type cd followed by a space, then drag the folder from Finder into the Terminal window. Terminal types out the full path for you, with any spaces in the folder names handled correctly. Press Return.

cd ~/Projects/site-redesign/assets

If you drag a file by mistake, you get the path to the file, and cd answers with “not a directory”. Delete the file name from the end of the line, or drag the folder instead.

When Finder and Terminal are not on screen together

Every dragging method above assumes you can see the folder and Terminal at the same moment. Often you cannot. Terminal is full screen, or it lives on another Space, or the folder is in a Finder window buried behind four others. The built-in workaround is to start the drag, keep the button held, press Command-Tab to bring Terminal forward and then let go. It works, but you are holding the folder the entire way.

Ledge gives the folder somewhere to wait. Drag it up to the notch at the top of the screen and let go; it lands on a shelf that drops from the notch and stays there. Switch to your terminal however you like, type cd and a space, open the shelf with Option-Space or a click on the notch, and drag the folder onto the terminal window. A terminal can use a path and cannot use a folder, so the path is what arrives, as text. The first time it pastes a path this way, macOS asks for Accessibility permission. Ledge does not ask for it at launch, only when that step is first needed.

The shelf holds more than one thing. Put the two or three project folders you move between all day on it, and each one is a drag away from being a cd, whichever window is in front. In Settings you choose which apps are routing destinations, so your terminal can stay on the shelf even when it is closed.

One thing to be deliberate about: where you let go matters, because each destination gets the form it can use. On a terminal the folder becomes a path. On a Finder window the folder itself moves there, and Command-Z in Finder puts it back.

To be plain about the limits: Ledge does not open Terminal windows for you and it does not run commands. It hands over the path, and the cd is still yours to type. It does not read or index what is in the folder either. It needs macOS 14 Sonoma or later, and on a Mac without a notch the shelf sits at the top center of the screen.

For more on the path side of this, see paste a file path into a terminal the easy way and paths with spaces in the terminal.

Going the other way

The reverse trip is one short command. In Terminal, type open . (the word open, a space and a period) and press Return. Finder opens a window showing the folder your terminal is in. Getting a file out of the terminal and into another app goes further with this.

Questions

Why is New Terminal at Folder missing from my right-click menu?

Either it is switched off or you clicked the wrong thing. It is offered for a selected folder, not for a file and not for the empty background of a window. If it is missing for folders too, turn it on in System Settings > Keyboard > Keyboard Shortcuts > Services, under Files and Folders.

Can I open Terminal in a folder with a keyboard shortcut?

Yes. In the same Services list, double-click to the right of New Terminal at Folder and press a key combination. It works whenever a folder is selected in Finder. Choose a combination Finder does not already use, or the shortcut will do the Finder command instead.

Does this work with a terminal app other than Apple’s?

The service and the path bar command open Apple’s Terminal. Dragging is more universal: typing cd and dragging a folder into the window works in practically every terminal, because all of them accept a path as text.