Skip to content

Instantly share code, notes, and snippets.

@didenko
Last active July 9, 2016 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save didenko/cdba4e2f8d524c641b4c89771be710c3 to your computer and use it in GitHub Desktop.
Save didenko/cdba4e2f8d524c641b4c89771be710c3 to your computer and use it in GitHub Desktop.
run iTerm2 in a specific folder (AppleScript) Raw
on run argv
tell application "iTerm"
if exists current window then
tell current window
create tab with default profile
end tell
else
create window with default profile
end if
tell current session of current tab of current window
write text "cd \"" & item 1 of argv & "\""
end tell
end tell
end run
@didenko
Copy link
Author

didenko commented Jul 9, 2016

Run the script with a directory name parameter, e.g.:

osascript itermcd.scpt /Users/me/code/project

It is a useful example of integration with other UI programs, like an CLion IDE example below calling iTerm2:

2016-07-09_06 50 14

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