27

I need to run multiple R sessions, and hope that they can be performed in different R sessions. In Windows, I am able to open an arbitrary number of R sessions, and run different codes in each session (both RGui and RStudio). However, in Mac OSX, neither R.app nor RStudio would allow me to open multiple independent sessions -- I have to wait until the first set of R codes are completed in order to run a second set of R codes.

Is there any solution in Mac OSX? This issues had bothered me long ago, so I'd like to hear your suggestions. Thanks!

alittleboy
  • 10,616
  • 23
  • 67
  • 107
  • 3
    You can run multiple sessions on the command line, using Terminal or iterm, etc. – sckott Nov 02 '13 at 22:28
  • @ScottChamberlain: thanks! I didn't thought about that... is it the only solution in Mac? – alittleboy Nov 02 '13 at 22:31
  • 1
    You can always just run R from the command line to get as many sessions as you want. You can also install emacs and ess, which will also permit multiple sessions. – mrip Nov 02 '13 at 22:31
  • 1
    @alittleboy I don't know of other solutions. If I need multiple sessions I always use the command line via iTerm (a bit nicer than using the standard terminal app – sckott Nov 02 '13 at 23:02
  • 1
    You can duplicate the entire R.app package by option-dragging (and you can rename the copies). Haven't tried this with RStudio.app. – bdemarest Nov 03 '13 at 00:23
  • 21
    `open -n /Applications/RStudio.app` in Terminal – wush978 Nov 03 '13 at 01:58
  • 8
    The easiest way to run multiple rstudio sessions is to use projects - I usually have 3 or 4 running at once. – hadley Nov 03 '13 at 13:47
  • @hadley on RStudio-server on ubuntu & try to switch between projects I'm always asked if I want to terminate my currently running session (say, when it's in the middle of executing some code). Does the code really keep running when you switch between RStudio projects on a Mac? – cboettig Dec 04 '14 at 01:34
  • @cboettig switching closes the old one. I think there's some limitations with projects on rstudio server. – hadley Dec 04 '14 at 02:40

4 Answers4

49

Thank you for all the suggestions. Here is a brief summary of the possible solutions:

  1. Using Terminal: Run: open -n /Applications/RStudio.app in Terminal
  2. Install Emacs and ESS which permit multiple sessions
  3. Duplicate the entire R.app package by option-dragging (and you can rename the copies)
  4. Run multiple rstudio sessions using projects
Rik Smith-Unna
  • 3,465
  • 2
  • 21
  • 21
alittleboy
  • 10,616
  • 23
  • 67
  • 107
18

Opens another instance of an application in OSX:

open -n -a "APPLICATION NAME"

In this case you'd just do:

open -n -a "rstudio"

CNET article source

goldisfine
  • 4,742
  • 11
  • 59
  • 83
2

I use this all the time on Mac OSX to open multiple Rgui sessions (similar to the Rstudio answer above): open -n /Applications/R.app/ You can do this multiple times for as many R sessions as you want.

2

Another option for RStudio is to right click the RStudio icon of a current session and select "New RStudio Window":

enter image description here

josliber
  • 43,891
  • 12
  • 98
  • 133