Skip to content

Instantly share code, notes, and snippets.

@tanob
Created April 28, 2011 04:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tanob/945821 to your computer and use it in GitHub Desktop.
Save tanob/945821 to your computer and use it in GitHub Desktop.
AppleScript to open a new tab in iTerm2 from Finder
-- Stefan van den Oord, 2010-12-29
-- The "cd to" command for iTerm2
-- Original from: http://code.google.com/p/iterm2/wiki/AppleScript
-- Modified to open a new tab instead of a new window
tell application "Finder"
set _cwd to POSIX path of ((folder of (front window)) as alias)
end tell
tell application "iTerm"
activate
set _term to last terminal
tell _term
launch session "Default"
set _session to current session
end tell
tell _session
write text "pushd \"" & _cwd & "\""
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment