Open Finder Folder in New Terminal Window
In this article
Yes, you can open a selected Finder folder in a new Terminal window on macOS. The easiest way is to drag the folder onto the Terminal icon in the Dock, or use the built-in Services menu. This article explains both methods and several alternatives, along with common pitfalls and customization options.
Why Open a Folder in Terminal?
Terminal is the command-line interface for macOS. When you open a folder in Terminal, the shell (usually zsh) starts with that folder as its current working directory. This is useful for running commands like git status, ls, or python script.py directly on the files in that folder without having to type a long path. It also helps when you need to perform batch operations, edit configuration files, or run development servers.
Method 1: Drag and Drop onto Terminal Icon
This is the simplest method and works with both the Terminal app and any third-party terminal emulator (like iTerm2).
- Open Finder and navigate to the folder you want to open.
- Click and hold the folder icon.
- Drag it onto the Terminal icon in the Dock. Do not release until the Terminal window highlights.
- Release the mouse. A new Terminal window will open with the folder as the current directory.
If Terminal is not in your Dock, you can drag the folder onto the Terminal icon in the Applications folder or use Spotlight to launch Terminal first, then drag the folder onto its Dock icon.
Method 2: Using the Services Menu
macOS includes a built-in service that opens a folder in Terminal. This method is slightly hidden but very convenient once you know it.
- Right-click (or Control-click) the folder in Finder.
- Scroll down to Services in the context menu.
- Select New Terminal at Folder (or New Terminal Tab at Folder if you prefer a tab).
If you don't see these options, you may need to enable them in System Settings > Keyboard > Keyboard Shortcuts > Services. Look under “Files and Folders” and check “New Terminal at Folder” and “New Terminal Tab at Folder”.
Method 3: Using the Terminal Command
If you prefer typing, you can use the open command with the -a flag to specify Terminal, or use the cd command after launching Terminal.
- Open Terminal from Applications > Utilities.
- Type
cdfollowed by a space, then drag the folder from Finder onto the Terminal window. This will insert the full path. - Press Enter. The shell will change to that directory.
Alternatively, you can use open -a Terminal /path/to/folder. This opens a new Terminal window with that folder as the working directory.
How to Make It a One-Click Shortcut
If you frequently open folders in Terminal, you can create a keyboard shortcut or use a third-party tool.
- Keyboard Shortcut: In System Settings > Keyboard > Keyboard Shortcuts > Services, you can assign a shortcut to the “New Terminal at Folder” service. For example, set it to Command+Shift+T.
- Finder Toolbar: You can add a “Terminal” button to the Finder toolbar using a third-party app like “Go2Shell” or by creating a custom Automator workflow. This adds a button that opens the current Finder folder in Terminal.
- Terminal Preferences: In Terminal > Settings > Profiles > Shell, you can set the “New window opens with” option to “Same working directory” or “Home directory”. This doesn’t open a specific folder but changes the default behavior.
Common Problems and Solutions
Sometimes the drag-and-drop method doesn't work as expected. Here are a few issues and fixes:
- Terminal opens but the folder is not the working directory: This can happen if you drop the folder on the Terminal window instead of the Dock icon. Dropping on the window may just paste the path. Always drop on the Dock icon.
- Services menu item is grayed out: Ensure you have selected a folder (not a file) and that the “New Terminal at Folder” service is enabled in System Settings.
- Terminal opens in a new tab instead of a window: If you have Terminal set to open new tabs by default, it may open a tab. You can change this in Terminal > Settings > Profiles > Window.
- Permission denied: If you see “Permission denied” when trying to access the folder, you may not have read permissions. Check the folder’s Get Info panel.
Alternatives to Terminal
If you need more than just a basic terminal, consider these alternatives:
- iTerm2: A popular terminal emulator that supports drag-and-drop, split panes, and extensive customization. It also has a “Open in iTerm” service.
- Visual Studio Code: If you use VS Code, you can right-click a folder in Finder and choose “Open with Code”, then open a terminal inside the editor. This is useful for developers.
- Finder’s “New Terminal at Folder” via Automator: You can create a Finder toolbar button using Automator that runs a shell script to open Terminal at the current folder.
Frequently Asked Questions
How do I open a folder in Terminal on Mac?
Drag the folder from Finder onto the Terminal icon in the Dock, or right-click the folder and go to Services > New Terminal at Folder. You can also type cd in Terminal and drag the folder onto the window to paste its path.
Why doesn't the drag-and-drop work?
Make sure you drop the folder onto the Terminal icon in the Dock, not onto the Terminal window itself. Also ensure that Terminal is not in “Full Screen” mode, as drag-and-drop may not work in that mode.
Can I open a folder in a new tab instead of a new window?
Yes, use the Services menu and choose “New Terminal Tab at Folder”. You can also change Terminal’s default behavior in Settings > Profiles > Window to open new tabs instead of windows.
How do I open a folder in Terminal from the command line?
Use the open command with the -a flag: open -a Terminal /path/to/folder. This opens a new Terminal window with that folder as the working directory.
Is there a way to open the current Finder window in Terminal?
Yes, you can use a third-party tool like “Go2Shell” or create an Automator service that gets the current Finder folder and opens it in Terminal. Alternatively, use the Services menu if you have the folder selected.
Does this work on macOS Sequoia or Sonoma?
Yes, the drag-and-drop and Services methods work on recent macOS versions. The exact menu names may differ slightly, but the functionality remains the same.