<h1>Motivation</h1>
<p>I had to install RStudio Server in a computer recently upgraded to OS X Sierra. The steps are the same as in a previous post (<a href="http://pacha.hk/rstudio_server.html">RStudio Server on OS X El Capitan
</a>)</p>
<h1>Homebrew setup</h1>
<p>If you don't have <a href="http://brew.sh/">Homebrew</a> installed you'll need to install it first.</p>
<p>In my opinion is it better to install <a href="https://developer.apple.com/download/more/">XCode 8 Command Line Tools</a> rather than using the App Store to download XCode 8.</p>
<p>Once you are ready installing Homebrew run these lines from terminal:</p>
<div><pre><span></span>brew update 
brew tap homebrew/science
brew install r openssl ant
brew install homebrew/science/rstudio-server
</pre></div>
<p>Beware that this will relink the R binaries to <code>/usr/local/bin</code>. It will also install the last R version (3.3.2 on November 25, 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.</p>
<h1>Additional steps</h1>
<p>The last part won't make <code>rstudio-server</code> running. You'll need some additional steps.</p>
<p>Copy a pre-made plist:</p>
<div><pre><span></span>sudo cp /usr/local/opt/rstudio-server/share/com.rstudio.launchd.rserver.plist /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist
</pre></div>
<p>Check permissions:</p>
<div><pre><span></span>sudo chown root:wheel /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist 
sudo chmod 644 /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist
</pre></div>
<p>Modify the plist and enable <code>rstudio-server</code> autostart:</p>
<div><pre><span></span>sudo nano /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist
</pre></div>
<p>and replace the content by this</p>
<div><pre><span></span><span>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?></span>
<span>&lt;!DOCTYPE plist PUBLIC &quot;-//Apple Computer//DTD PLIST 1.0//EN&quot;</span>
<span> &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;></span>
<span>&lt;plist</span> <span>version=</span><span>&quot;1.0&quot;</span><span>></span>
<span>&lt;dict></span>
        <span>&lt;key></span>Label<span>&lt;/key></span>
        <span>&lt;string></span>com.rstudio.launchd.rserver<span>&lt;/string></span>
        <span>&lt;key></span>ProgramArguments<span>&lt;/key></span>
        <span>&lt;array></span>
                <span>&lt;string></span>/usr/local/opt/rstudio-server/bin/rserver<span>&lt;/string></span>
                <span>&lt;string></span>--server-daemonize=0<span>&lt;/string></span>
                <span>&lt;string></span>--auth-minimum-user-id=500<span>&lt;/string></span>
        <span>&lt;/array></span>
        <span>&lt;key></span>RunAtLoad<span>&lt;/key></span>
        <span>&lt;true/></span>
<span>&lt;/dict></span>
<span>&lt;/plist></span>
</pre></div>
<p>Copy a pam:</p>
<div><pre><span></span>sudo cp /etc/pam.d/ftpd /etc/pam.d/rstudio
</pre></div>
<p>Launch the daemon and start <code>rstudio-server</code> (i.e. sometimes you can't restart your server without affecting other users):</p>
<div><pre><span></span>sudo launchctl load -w /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist
sudo rstudio-server start
</pre></div>
<p>Create <code>rstudio</code> group (in OS X El Capitan and later OS X versions you need to do this):</p>
<p>Go to <code>System Preferences -> Users &amp; Groups -> Add</code>, create a group named <code>rstudio</code> and click all the users you want to authorize to use <code>rstudio-server</code>.</p>
<h1>Using rstudio-server</h1>
<p>From your server go to <code>localhost:8787</code> and you should be able to login usign your OS X credentials.</p>
<p>To login from another computer on the same network, from your browser go to your server's IP on port 8787 (e.g. <code>123.45.67.89:8787</code>)</p>