Is there an easy way to open a terminal at the current directory in Finder?

I found an option to open a terminal in a directory via the services feature, but you can only activate it from the parent directory of the directory where you want the terminal.


Is there a feature/way to easily open a terminal to the currently displayed directory in finder easily? An icon right on the finder toolbar would be ideal.

MacBook Pro 16″, macOS 13.3

Posted on May 11, 2023 5:57 PM

Reply
Question marked as Top-ranking reply

Posted on May 12, 2023 1:47 PM

On Ventura 13.3.1 (a), and in Settings > Keyboard > Keyboard Shortcuts > Services panel > Files and Folders, there are two services that need to be enabled, if not already:



Once that is done, right-click on your random depth folder in the Finder and from the secondary Services menu, you will see both of the above services available to you.

27 replies
Question marked as Top-ranking reply

May 12, 2023 1:47 PM in response to kodiakcreativity

On Ventura 13.3.1 (a), and in Settings > Keyboard > Keyboard Shortcuts > Services panel > Files and Folders, there are two services that need to be enabled, if not already:



Once that is done, right-click on your random depth folder in the Finder and from the secondary Services menu, you will see both of the above services available to you.

May 12, 2023 1:43 PM in response to Barney-15E

on run {input, parameters}
	
	tell application "Finder" to set folderPath to POSIX path of (target of the front window as alias)
	
	tell application "Terminal" to open folderPath
end run


You have to set it to receive Files & Folders as input since selecting nothing in the window won't bring up the Quick Actions in the contextual menu. You could create a shortcut for the action and run it with that.

May 12, 2023 4:29 AM in response to kodiakcreativity

kodiakcreativity wrote:

I found an option to open a terminal in a directory via the services feature, but you can only activate it from the parent directory of the directory where you want the terminal.

Maybe I'm missing something. If I choose a folder nested deep within other folders the Terminal opens in that folder using Services. For example, if I choose ~/Library/Application Support/Acorn from Services, The Terminal opens there: *****@iMac-5K Acorn %

May 12, 2023 11:45 AM in response to dialabrain

dialabrain wrote:

Maybe I'm missing something. If I choose a folder nested deep within other folders the Terminal opens in that folder using Services. For example, if I choose ~/Library/Application Support/Acorn from Services, The Terminal opens there: *****@iMac-5K Acorn %

Apple must have added this functionality at some point over the years. I'm glad I didn't waste any more time on it.

May 12, 2023 1:19 PM in response to Randall_2023

Open Keyboard System Settings > Keyboard Shortcuts > Services and enable it.


However, as I understand the question, the kodiakcreativity wants to open the current folder in the shell. That Service opens the selected folder in the shell. You must have a folder selected to see that Service as it is designed to take a folder as input.

That might be possible by getting the frontmost window's target with an AppleScript action, then passing that to Terminal or run a shell script.

May 12, 2023 3:38 PM in response to dialabrain

I had to toggle the above 2 entries for them to appear as Finder Services.



That is to say, initially they were not there, but I did have 2 similar items for iTerm2. After unchecking them, then re-checking them, in


System Preferences -> Keyboard -> Shortcuts (tab) -> Service (item in the left column)


they appeared when I did a Right-Click (Control-Click) on a Folder in a Finder window.


NOTE: If you do not have these items in your System Preferences -> Keyboard -> Shortcuts, then I'll assume I installed something years ago that has been following me around, because I've been a hardcore real terminal and terminal emulator users since the '70's, so who knows what I've picked up along the way.


I do not know if that helps or hinders the mystery.



May 12, 2023 4:39 PM in response to BobHarris

Thanks Bob, I tried your example but it didn't work for me. I toggled 2-3 times and even rebooted but the options still never showed up under a right click services menu on a folder within Finder.

That said, as I mentioned above, people can add one quite easily using Automator from the service menu called create workflow and then create a quick action. It works fine on top level folders and deeply imbedded folders with huge paths just as well. That solves the problem for me. Hope it helps others as well. It is sort of handy to use when a path is extremely long.

PS - I am using a 2021 M1 iMac with Ventura 13.3.1 (a)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Is there an easy way to open a terminal at the current directory in Finder?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.