Instantly share code, notes, and snippets.

What would you like to do?
Add an icon to your finder toolbar to open iTerm in the current folder.

Open iTerm from finder

The code and instructions in this gist are from I've had to do this a few times and wanted to distill it the basics.

  1. Open Automator
  2. Create an Application
  3. Choose Actions > Utilities > Run Applescript
  4. Paste the contents of into the window.
  5. Save the script somewhere convenient
  6. Find the script, then drag the script onto the Finder window while holding the command key (or in Yosemite, the command + option keys)
on run {input, parameters}
tell application "Finder"
set dir_path to quoted form of (POSIX path of (folder of the front window as alias))
end tell
end run
on CD_to(theDir)
tell application "iTerm"
set sesh to current session of current terminal
on error
set term to (make new terminal)
tell term
launch session "Default"
set sesh to current session
end tell
end try
tell sesh
write text "cd " & theDir & ";clear;"
end tell
end tell
end CD_to

This comment has been minimized.

nhducit commented Jul 26, 2016

I got this error when click on the icon in finder application: "The action “Run AppleScript” encountered an error."


This comment has been minimized.

smyth64 commented Sep 18, 2016



This comment has been minimized.


This comment has been minimized.

damenleeturks commented Apr 12, 2018

Thanks for including a link to an updated script, @smith64fx!


This comment has been minimized.

dm-grinko commented Aug 24, 2018

@smith64fx! Thank you


This comment has been minimized.

isaken commented Oct 25, 2018

Didn't work (iterm 3.1.7). This other solution works well for me:

The peterdowns link is dead, however his repo is live here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment