Open Terminal to currently open Finder window using AppleScript

There are a lot of different utilities that you can find (and buy) that does the simple task of opening your Terminal to the currently open Finder location. One problem with these solutions is they tend to break when OSX has an update. I finally got tired of having to keep getting a new one to make it work, and worse having to pay for something thats simple to do in AppleScript. Copy this text into your AppleScript Editor and save it as a run only application called finder2term.

tell application Finder
	activate
	set this_folder to (the target of the front window) as alias
	set my_path to POSIX path of this_folder
	tell application Terminal
		activate
		do shell script "cd my_path"
	end tell
end tell

Place this application in your /Applications/Utilities. I copied the icon from the Terminal.app Select Terminal in that utilities folder and tap -i to get info, click on the icon in the upper left corner of the get info dialogue and hit to copy it. Close that window and then select the finder2term app in that utilities folder and tap -i to get info, click on the icon in the upper left corner of the get info dialogue and hit to paste the icon in place. Close that window. Now drag finder2term from the window. Now when you have a finder window open you can click this icon and have a new terminal window opened to that directory. I have also found that this solution is MUCH faster than the apps that do the same thing. Enjoy!

Related Posts