How to open a MacOS Terminal in the current Finder folder

Apple/MacOS Terminal/Finder tip: This tutorial shows how to open a Mac Terminal window in the current Finder folder by using AppleScript.

For a while I have wanted to be able to open a Mac Terminal window in the same directory as the Mac Finder folder that I’m currently looking at. I couldn’t find any other way to do this, so I finally wrote an AppleScript script to do it. Fortunately the script is pretty simple. Here's the code:

tell application "Finder"
    set myWin to window 1
    set thePath to (quoted form of POSIX path of (target of myWin as alias))
    tell application "Terminal"
        activate
        tell window 1
            do script "cd " & thePath
        end tell
    end tell
end tell

When I have a Mac Finder window in the foreground and run this script from the AppleScript menu on the MacOS menubar, it opens a Mac Terminal window, and automatically places me in the same directory as the current Finder folder. Sweet.

Related

In summary, if you wanted to see how to open a MacOS Terminal window in the current Mac Finder path, I hope this