I regularly find myself navigating to a folder in the Finder and then wanting to quickly get a Terminal window in the same location. In the past I would open a Terminal window, type cd and a space, then drag and drop the folder in question from the Finder into the Terminal and hit enter. Thanks to OS X’s great drag-and-drop support that works, and while it is easier than typing out the whole path (even with tab-complete), it’s still quite cumbersome.

Today inspiration hit me – the open command should let me open a folder with the Terminal, so I tested it, and it does. Armed with this simple command line solution I opened up Automator and threw together a simple OS X service that takes a folder as input. The service has only one action, a Run Shell Script action with the shell set to bash, the input passed as arguments, and the following content:

for f in "$@"
do
	/usr/bin/open "$f" -a /Applications/Utilities/Terminal.app/
done

Screenshot of Service
Click to Enlarge

It will only take seconds to re-create this service yourself, but for convenience, I’ve zipped up my copy of the service and am attaching it to this post. Install it by unzipping and adding to either ~/Library/Services/ (for just yourself) or /Library/Services/ (for all users).

Download

Once the service is installed it will show up in the Services menu in the Finder when ever you have one or more folders selected:

Terminal Here Service In Action
Click to Enlarge

You can also get to the service by right-clicking on any folder in the Finder:

Terminal Here Service In Action - Right Click
Click to Enlarge

Finally – if you keep the optional Path Bar shown in the Finder you can also right-click on a Folder there to access the service (including the folder you are in):

Terminal Here Service in Action - Path Bar
Click to Enlarge