Skip to content

Instantly share code, notes, and snippets.

@jweisber
Last active December 11, 2017 05:36
Show Gist options
  • Save jweisber/26e1e4cf658804c9e2f957a0c46f3392 to your computer and use it in GitHub Desktop.
Save jweisber/26e1e4cf658804c9e2f957a0c46f3392 to your computer and use it in GitHub Desktop.
Open iTerm from Rstudio: replace /Applications/RStudio.app/Contents/MacOS/mac-terminal (see http://tinyurl.com/jvf6lbx, which is now out of date).
#!/usr/bin/osascript
on run argv
set dir to quoted form of (first item of argv)
if application "iTerm" is running then
set wasRunning to true
else
set wasRunning to false
end if
tell application "iTerm"
activate
if wasRunning then
tell current window
create tab with default profile
end tell
end if
tell last session of current tab of current window
set name to "RStudio Session"
write text "cd " & dir & "; clear"
end tell
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment