RStudio Server on OS X El Capitan

[This article was first published on Reimagined Invention, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Motivation

This is the result of trial and error until I got RStudio Server working in my network

I have a powerful Mac Pro server and I wanted to use that computing from my “old” iMac (i.e. to do my calculations in a fraction of the time that it would take using my own iMac’s resources)

Homebrew setup

There is a good tutorial for older versions of OS X here. With El Capitan it won’t work, or at least didn’t work for me.

If you don’t have Homebrew installed you’ll need to install it first.

Run these lines from terminal:

brew update 
brew tap homebrew/science
brew install r openssl ant
brew install homebrew/science/rstudio-server

Beware that this will relink the R binaries to /usr/local/bin. It will also install the last R version (3.3.1 on October 21, 2016). Therefore, it would be a good idea to uninstall the previous R version that you have or you will be misusing your drive space.

Additional steps

The last part won’t make rstudio-server running. Similar to what I asked on stackexchange you’ll need some additional steps:

Copy a pre-made plist:

sudo cp /usr/local/opt/rstudio-server/share/com.rstudio.launchd.rserver.plist /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist

Check permissions:

sudo chown root:wheel /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist 
sudo chmod 644 /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist

Modify the plist and enable rstudio-server autostart:

sudo nano /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist

and replace the content by this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
        "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>com.rstudio.launchd.rserver</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/local/opt/rstudio-server/bin/rserver</string>
                <string>--server-daemonize=0</string>
                <string>--auth-minimum-user-id=500</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
</dict>
</plist>

Copy a pam:

sudo cp /etc/pam.d/ftpd /etc/pam.d/rstudio

Launch the daemon and start rstudio-server (i.e. sometimes you can’t restart your server without affecting other users):

sudo launchctl load -w /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist
sudo rstudio-server start

Create rstudio group (additional step not mentioned on stackexchange):

Go to System Preferences -> Users & Groups -> Add, create a group named rstudio and click all the users you want to authorize to use rstudio-server.

Using rstudio-server

From your server go to localhost:8787 and you should be able to login usign your OS X credentials.

To login from another computer on the same network, from your browser go to your server’s IP on port 8787 (e.g. 123.45.67.89:8787)

To leave a comment for the author, please follow the link and comment on their blog: Reimagined Invention.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)