If you’re like me, you take great comfort in the presence of the Terminal in Mac OS X. I love a great GUI, but the fact is that many tasks on the Mac are still best accomplished from the behind the wheel of a shiny new pseudo-tty.
Usually I get the need for command-line access to an object just as I’m browsing near it in the Finder. In the bad old days, I would laboriously open the Terminal, type “cd “, then drag a copy of the item I’m interested in to the Terminal, and if it was a file, torturously edit out the leaf-name part of the path before hitting return!
Grr! I’m getting stressed out just thinking about it! Things have gotten better for me since I sat down and wrote a handy script to accomplish all of this for me. My Terminal At Location script does just what its title implies: opens a new terminal window with the current path set to the object of your current Finder-fixation. You can download this script from the Red Sweater AppleScript Page.
I have this script configured as an application-specific keyboard shortcut for the Finder. Whenever I need to “switch to command-line mode” I just hit Cmd-Shift-T and I’m off-and-running. If you don’t already have an application-specific keyboard shortcut tool for quickly running AppleScripts, then allow me to give my unbiased (ahem) endorsement of FastScripts. Create a Finder-specific scripts folder, drop the script in, and select it from the FastScripts menu while holding down the Cmd key to quickly set your desired shortcut.
If you spend a lot of time switching between the Finder and the Terminal, you will not forgive yourself for failing to set up a script like this sooner.
Update:Version 1.0.1 of the script fixes a bug that caused terminal parsing errors for paths with funny characters in them.