

{"id":2878,"date":"2014-01-10T09:31:16","date_gmt":"2014-01-10T14:31:16","guid":{"rendered":"http:\/\/rud.is\/b\/?p=2878"},"modified":"2014-01-10T09:31:16","modified_gmt":"2014-01-10T14:31:16","slug":"change-the-default-shell-action-in-rstudio-for-os-x","status":"publish","type":"post","link":"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/","title":{"rendered":"Change The Default &#8220;Shell&#8230;&#8221; Action In RStudio for OS X"},"content":{"rendered":"<p>RStudio is my R development environment of choice and I work primarily on\/in Mac OS X. While it&#8217;s great that Apple provides a built-in Terminal application, I prefer to use [iTerm 2](http:\/\/www.iterm2.com\/#\/section\/home) when I need to do work at a shell. The fine folks at RStudio provide a handy `Shell`&hellip; menu item off the `Tools` menu, but it (rightly) defaults to using Apple&#8217;s Terminal.app for functionality since they can&#8217;t assume what terminal application you are using.<\/p>\n<p>To change it to iTerm (or whatever your favorite terminal application is) you need to fire up a text editor and change (make a backup first!) `\/Applications\/RStudio.app\/Contents\/MacOS\/mac-terminal` to contain the following modified AppleScript:<\/p>\n<pre lang=\"applescript\">#!\/usr\/bin\/osascript\r\non run argv\r\n  set dir to quoted form of (first item of argv)\r\n  tell app \"iTerm\"\r\n    activate\r\n    tell the first terminal\r\n      launch session \"Default Session\"\r\n      tell the last session\r\n        set name to \"RStudio Session\"\r\n        write text \"cd \" & dir\r\n      end tell\r\n    end tell\r\n  end tell\r\nend run<\/pre>\n<p>That will open a new tab in iTerm, set the session (tab) name to &#8220;RStudio Session&#8221; and change the directory to the current working directory in RStudio.<\/p>\n<p>More often than not, I&#8217;m just using [Alfred](http:\/\/www.alfredapp.com\/) to kick up iTerm and doing the `cd` myself, but this added tweak (which you have to do **every** time you upgrade RStudio) reduces the churn when I do end up using the feature within RStudio.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>RStudio is my R development environment of choice and I work primarily on\/in Mac OS X. While it&#8217;s great that Apple provides a built-in Terminal application, I prefer to use [iTerm 2](http:\/\/www.iterm2.com\/#\/section\/home) when I need to do work at a shell. The fine folks at RStudio provide a handy `Shell`&hellip; menu item off the `Tools` [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[663,12,91,699],"tags":[],"class_list":["post-2878","post","type-post","status-publish","format-standard","hentry","category-apple","category-os-x","category-r","category-rstudio"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Change The Default &quot;Shell...&quot; Action In RStudio for OS X - rud.is<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Change The Default &quot;Shell...&quot; Action In RStudio for OS X - rud.is\" \/>\n<meta property=\"og:description\" content=\"RStudio is my R development environment of choice and I work primarily on\/in Mac OS X. While it&#8217;s great that Apple provides a built-in Terminal application, I prefer to use [iTerm 2](http:\/\/www.iterm2.com\/#\/section\/home) when I need to do work at a shell. The fine folks at RStudio provide a handy `Shell`&hellip; menu item off the `Tools` [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/\" \/>\n<meta property=\"og:site_name\" content=\"rud.is\" \/>\n<meta property=\"article:published_time\" content=\"2014-01-10T14:31:16+00:00\" \/>\n<meta name=\"author\" content=\"hrbrmstr\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"hrbrmstr\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/\"},\"author\":{\"name\":\"hrbrmstr\",\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"headline\":\"Change The Default &#8220;Shell&#8230;&#8221; Action In RStudio for OS X\",\"datePublished\":\"2014-01-10T14:31:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/\"},\"wordCount\":211,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"articleSection\":[\"Apple\",\"OS X\",\"R\",\"RStudio\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/\",\"url\":\"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/\",\"name\":\"Change The Default \\\"Shell...\\\" Action In RStudio for OS X - rud.is\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/#website\"},\"datePublished\":\"2014-01-10T14:31:16+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/rud.is\/b\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Change The Default &#8220;Shell&#8230;&#8221; Action In RStudio for OS X\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/rud.is\/b\/#website\",\"url\":\"https:\/\/rud.is\/b\/\",\"name\":\"rud.is\",\"description\":\"&quot;In God we trust. All others must bring data&quot;\",\"publisher\":{\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/rud.is\/b\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\",\"name\":\"hrbrmstr\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1\",\"url\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1\",\"width\":460,\"height\":460,\"caption\":\"hrbrmstr\"},\"logo\":{\"@id\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1\"},\"description\":\"Don't look at me\u2026I do what he does \u2014 just slower. #rstats avuncular \u2022 ?Resistance Fighter \u2022 Cook \u2022 Christian \u2022 [Master] Chef des Donn\u00e9es de S\u00e9curit\u00e9 @ @rapid7\",\"sameAs\":[\"http:\/\/rud.is\"],\"url\":\"https:\/\/rud.is\/b\/author\/hrbrmstr\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Change The Default \"Shell...\" Action In RStudio for OS X - rud.is","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/","og_locale":"en_US","og_type":"article","og_title":"Change The Default \"Shell...\" Action In RStudio for OS X - rud.is","og_description":"RStudio is my R development environment of choice and I work primarily on\/in Mac OS X. While it&#8217;s great that Apple provides a built-in Terminal application, I prefer to use [iTerm 2](http:\/\/www.iterm2.com\/#\/section\/home) when I need to do work at a shell. The fine folks at RStudio provide a handy `Shell`&hellip; menu item off the `Tools` [&hellip;]","og_url":"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/","og_site_name":"rud.is","article_published_time":"2014-01-10T14:31:16+00:00","author":"hrbrmstr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"hrbrmstr","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/#article","isPartOf":{"@id":"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/"},"author":{"name":"hrbrmstr","@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"headline":"Change The Default &#8220;Shell&#8230;&#8221; Action In RStudio for OS X","datePublished":"2014-01-10T14:31:16+00:00","mainEntityOfPage":{"@id":"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/"},"wordCount":211,"commentCount":0,"publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"articleSection":["Apple","OS X","R","RStudio"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/","url":"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/","name":"Change The Default \"Shell...\" Action In RStudio for OS X - rud.is","isPartOf":{"@id":"https:\/\/rud.is\/b\/#website"},"datePublished":"2014-01-10T14:31:16+00:00","breadcrumb":{"@id":"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/rud.is\/b\/2014\/01\/10\/change-the-default-shell-action-in-rstudio-for-os-x\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rud.is\/b\/"},{"@type":"ListItem","position":2,"name":"Change The Default &#8220;Shell&#8230;&#8221; Action In RStudio for OS X"}]},{"@type":"WebSite","@id":"https:\/\/rud.is\/b\/#website","url":"https:\/\/rud.is\/b\/","name":"rud.is","description":"&quot;In God we trust. All others must bring data&quot;","publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/rud.is\/b\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886","name":"hrbrmstr","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","contentUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","width":460,"height":460,"caption":"hrbrmstr"},"logo":{"@id":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1"},"description":"Don't look at me\u2026I do what he does \u2014 just slower. #rstats avuncular \u2022 ?Resistance Fighter \u2022 Cook \u2022 Christian \u2022 [Master] Chef des Donn\u00e9es de S\u00e9curit\u00e9 @ @rapid7","sameAs":["http:\/\/rud.is"],"url":"https:\/\/rud.is\/b\/author\/hrbrmstr\/"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p23idr-Kq","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":9475,"url":"https:\/\/rud.is\/b\/2018\/04\/06\/adding-macos-touch-bar-support-to-rstudio\/","url_meta":{"origin":2878,"position":0},"title":"Adding macOS Touch Bar Support to RStudio","author":"hrbrmstr","date":"2018-04-06","format":false,"excerpt":"Modern MacBook Pros have a fairly useless (c'mon, admit it!) \"Touch Bar\" that did little more than cause severe ire in the developer community after turning a full-fledged, tactile Escape key into a hollow version if its former self. Having said, that, some apps do make OK use of it,\u2026","rel":"","context":"In &quot;R&quot;","block_context":{"text":"R","link":"https:\/\/rud.is\/b\/category\/r\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4772,"url":"https:\/\/rud.is\/b\/2016\/12\/22\/pipes-everywhere\/","url_meta":{"origin":2878,"position":1},"title":"Pipes (%>%) Everywhere","author":"hrbrmstr","date":"2016-12-22","format":false,"excerpt":"An R user asked a question regarding whether it's possible to have the RStudio pipe (%>%) shortcut (Cmd-Shift-M) available in other macOS applications. If you're using Alfred then you can use this workflow for said task (IIRC this requires an Alfred license which is reasonably cheap). When you add it\u2026","rel":"","context":"In &quot;Alfred&quot;","block_context":{"text":"Alfred","link":"https:\/\/rud.is\/b\/category\/alfred\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3709,"url":"https:\/\/rud.is\/b\/2015\/10\/20\/installing-r-on-os-x\/","url_meta":{"origin":2878,"position":2},"title":"Installing R on OS X","author":"hrbrmstr","date":"2015-10-20","format":false,"excerpt":"NOTE: The comments are a must read for this. Some excellent additional advice and \"gotchas\" by some super-helpful readers. I was in a conversation with an academic colleague (wicked smart dude) and the subject of installing R came up (NOTE: this will happen to you, too, if you ever have\u2026","rel":"","context":"In &quot;OS X&quot;","block_context":{"text":"OS X","link":"https:\/\/rud.is\/b\/category\/os-x\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3732,"url":"https:\/\/rud.is\/b\/2015\/10\/22\/installing-r-on-os-x-100-homebrew-edition\/","url_meta":{"origin":2878,"position":3},"title":"Installing R on OS X &#8211; &#8220;100% Homebrew Edition&#8221;","author":"hrbrmstr","date":"2015-10-22","format":false,"excerpt":"In a previous post I provided \"mouse-heavy\" instructions for getting R running on your Mac. A few of the comments suggested that an \"all Homebrew\" solution may be preferable for some folks. Now, there are issues with this since getting \"support\" for what may be R issues will be very\u2026","rel":"","context":"In &quot;OS X&quot;","block_context":{"text":"OS X","link":"https:\/\/rud.is\/b\/category\/os-x\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2601,"url":"https:\/\/rud.is\/b\/2013\/08\/25\/use-fluid-on-macos-to-build-per-rstudio-server-dedicated-clients\/","url_meta":{"origin":2878,"position":4},"title":"Use Fluid On MacOS To Build Per-RStudio Server &#8220;Dedicated&#8221; Clients","author":"hrbrmstr","date":"2013-08-25","format":false,"excerpt":"I'm jumping around analytics environments these days and have to leave the comfort of my Mac's RStudio Desktop application to use various RStudio Server instances via browser. While I prefer to use Chrome, the need to have a \"dedicated\" RStudio Server client outweighs the utility of my favorite browser. This\u2026","rel":"","context":"In &quot;OS X&quot;","block_context":{"text":"OS X","link":"https:\/\/rud.is\/b\/category\/os-x\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5796,"url":"https:\/\/rud.is\/b\/2017\/04\/07\/r%e2%81%b6-rstudio-server-client-make-an-app-for-that\/","url_meta":{"origin":2878,"position":5},"title":"R\u2076 \u2014 RStudio Server Client? Make An App For That!","author":"hrbrmstr","date":"2017-04-07","format":false,"excerpt":"RStudio is a great way to work through analyses tasks, and I suspect most folks use the \"desktop\" version of the product on their local workstations. The fine folks at RStudio also make a server version (the codebase for RStudio is able to generate server or desktop and they are\u2026","rel":"","context":"In &quot;R&quot;","block_context":{"text":"R","link":"https:\/\/rud.is\/b\/category\/r\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/2878","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/comments?post=2878"}],"version-history":[{"count":0,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/2878\/revisions"}],"wp:attachment":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media?parent=2878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/categories?post=2878"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/tags?post=2878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}