14 Answers
14

As of Mac OS X Lion 10.7, Terminal provides Services for opening a new terminal window or tab at the selected folder in Finder. They also work with absolute pathnames selected in text (in any application). You can enable these services with System Preferences > Keyboard > Keyboard Shortcuts > Services. Look for "New Terminal at Folder" and "New Terminal Tab at Folder". You can also assign them shortcut keys.

In addition, you can now drag folders (and pathnames) onto the Terminal application icon to open a new terminal window, or onto a tab bar in a terminal window to create a new tab in that window. If you drag onto a tab (rather than into the terminal view) it will execute a complete cd command to switch to that directory without any additional typing.

As of OS X Mountain Lion 10.8, Command-Dragging into a terminal will also execute a complete cd command.

cdto seems like it is just what you need. It is a mini-application, designed to be put in the Finder's toolbar, when you run it it will open a terminal window and cd to the current directory in Finder.

You can drag any file or folder from the finder onto a Terminal window to insert a string of said file or folder's absolute path.

This will work on any standard install (at least back until 10.4 Tiger [¿maybe earlier?]) without needing additional software our twiddling of preferences, either of which may later freak out your non-techy friend if it happens to be his/her Mac that you’re working on. This trick also works for any process that is running in the Terminal, e.g. emacs or vi (assuming you’ve got vi in the appropriate mode, or however it is that you people who use vi do).

tell application "Finder" to set p to POSIX path of (insertion location as alias)
tell application "Terminal"
if (exists window 1) and not busy of window 1 then
do script "cd " & quoted form of p in window 1
else
do script "cd " & quoted form of p
end if
activate
end tell

Reuse an existing tab or create a new tab (Terminal):

tell application "Finder" to set p to POSIX path of (insertion location as alias)
tell application "Terminal"
if not (exists window 1) then reopen
activate
if busy of window 1 then
tell application "System Events" to keystroke "t" using command down
end if
do script "cd " & quoted form of p in window 1
end tell

Always create a new tab (iTerm 2):

tell application "Finder" to set p to POSIX path of (insertion location as alias)
tell application "iTerm"
if exists current terminal then
current terminal
else
make new terminal
end if
tell (launch session "Default") of result to write text "cd " & quoted form of p
activate
end tell

The first two scripts have a few advantages compared to the services added in 10.7:

As of 10.9, there is a bug where services that receive folders as input are never listed in the services menu in column view. If you assign the New Terminal Tab at Folder service a keyboard shortcut, it doesn't work in column view.

They use the folder on the title bar instead of requiring you to select a folder first.

They reuse the frontmost tab if it is not busy, e.g. running a command, displaying a man page, or running emacs.

If you use 10.7 or 10.8, change tell application "Finder" to set p to POSIX path of (insertion location as alias) to:

tell application "Finder"
if exists Finder window 1 then
set p to POSIX path of (target of Finder window 1 as alias)
else
set p to POSIX path of (path to desktop)
end if
end tell

There is a bug in 10.7 and 10.8 (but not in 10.9 or 10.6) where Finder ignores windows created after the last time focus was moved to another application and back when getting the insertion location property.