Skip to content

Instantly share code, notes, and snippets.

@julienr
Created June 4, 2014 20:44
Show Gist options
  • Save julienr/a9bd3ae9454cf011b08c to your computer and use it in GitHub Desktop.
Save julienr/a9bd3ae9454cf011b08c to your computer and use it in GitHub Desktop.
Open iTerm2 here in OSX
-- Automator AppleScript to add a finder toolbar icon to "open iterm2 window here"
-- * Create an Automator application
-- * Add this script as Utilities/Run AppleScript
-- * Drag the application to the finder toolbar with command pressed
(* http://peterdowns.com/posts/open-iterm-finder-service.html *)
on run {input, parameters}
tell application "Finder"
set dir_path to POSIX path of (folder of the front window as alias)
end tell
CD_to(dir_path)
end run
on CD_to(theDir)
tell application "iTerm"
activate
set t to (make new terminal)
tell t
set mysession to (make new session at the end of sessions)
tell mysession
exec command "/bin/zsh"
write text "cd " & theDir & ";clear;"
end tell
end tell
end tell
end CD_to
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment