I am trying to install RStudio Server in OSX El Capitan.

I did these steps from terminal

brew install openssl

brew install homebrew/science/rstudio-server

I have the login window at localhost:8787 but I can't login. If I run

sudo rstudio-server status 

then I get

Could not find service "com.rstudio.launchd.rserver" in domain for 

To check the installation I run

sudo rstudio-server verify-installation

and I get

21 Oct 2016 05:11:44 [rserver] ERROR system error 48 (Address already in use); 
OCCURRED AT: rstudio::core::Error rstudio::core::http::initTcpIpAcceptor(SocketAcceptorService<boost::asio::ip::tcp> &, const std::string &, const std::string &) /tmp/rstudio-server-20161017-46697-nr3wo3/rstudio-
0.99.902/src/cpp/core/include/core/http/TcpIpSocketUtils.hpp:103; LOGGED FROM: int main(int, char *const *) /tmp/rstudio-server-20161017-46697-nr3wo3/rstudio-0.99.902/src/cpp/server/ServerMain.cpp:438

How can I fix this?

You forgot to install and launch the related launch daemon and modify some other things. To fix this do the following:

  • 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:

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

    and replace

    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/opt/rstudio-server/bin/rserver</string>
        <string>--server-daemonize=0</string>
    </array>
    

    by

    <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>
    

    This step is necessary because rstudio-server's default auth-minimum-user-id is 1000 and the common OS X user's first ID is 501, the second user's ID is 502 etc.

  • Copy a pam:

    sudo cp /etc/pam.d/ftpd /etc/pam.d/rstudio
    
  • Launch the daemon and start rstudio:

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

Finally launch a broswer, enter localhost:8787 in the address bar and log-in with your OS X user credentials.

To stop rstudio server enter sudo rstudio-server stop. After a reboot you have to enter sudo rstudio-server start to start it again.


If you want the rstudio-server to be launched automatically while booting, stop the server, unload the launch daemon,

sudo rstudio-server stop
sudo launchctl unload -w /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist

modify the file /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist with nano and set the RunAtLoad key from false to true. Finally load the launch daemon again:

sudo launchctl load -w /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist
  • thanks a lot, this clearly helps I had to do an additional step that is to go to apple icon -> system preferences -> users & groups and add the group rstudio then it works – pachamaltese Oct 21 '16 at 23:24
  • probably network settings or something... but it works great ! – pachamaltese Oct 21 '16 at 23:46
  • @pachamaltese I don't have to create an rstudio group to have access immediately - but maybe I'm missing something because I set up a vanilla brew install of r/rstudio. But the description on your web page is not correct: if you set the key [RunAtLoad] to true, you don't have to start rstudio server explicitly once more with sudo rstudio-server start because it already runs after booting OS X. – klanomath Oct 22 '16 at 0:31
  • yes, that's right – pachamaltese Oct 22 '16 at 1:59
  • yes, that's right I did set autoboot not to run sudo rstudio-server start – pachamaltese Oct 22 '16 at 2:00

I Just want to give some updates for the updated formula rstudio-server v1.0.153.

Some of the files have been relocated for consistency.

/usr/local/opt/rstudio-server/share/com.rstudio.launchd.rserver.plist

was moved to

/usr/local/opt/rstudio-server/extras/launchd/com.rstudio.launchd.rserver.plist

and the pam file is now bundled with the formula

/usr/local/opt/rstudio-server/extras/pam/rstudio

Here I have explained the steps you provided and more: http://pacha.hk/rstudio_server.html

In general, you just can't restart the server without affecting other users.

Thanks a lot for the instructions.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.