[Mac] install RStudio-Server :: Homebrew

Published by onesixx on

Matt Furia


Installing R


RStudio Server를 설치하기 위해서는 R을 먼저 설치해야한다.

추가 package 설치 

C/C++ Compilers and Libraries

~|⇒ brew install gcc ccache cmake pkg-config autoconf automake

gcc(GNU compiler collection), ccache(Object-file caching compiler wrapper),
cmake(Cross-platform make), pkg-config(Manage compile and link flags for libraries),
autoconf(Automatic configure script builder), automake(Tool for generating GNU Standards-compliant Makefiles)

SSL/SSH Libraries -optional (Openssl)

~|⇒ brew install openssl openssl@1.1
~|⇒ brew install libressl libssh2

libressl(Version of the SSL/TLS protocol forked form OpenSSL),  libssh2(C library implementing the SSH2 protocol)


~|⇒ brew install git --with-brewed-openssl --with-pcre

version control을 위해 Apple에서도 git을 제공하지만, Homebrew를 통해 관리도 가능

pcre (Perl Compatible Regular Expressions)

PCRE library는 Perl5문법을 사용하여 정규식 패턴 매칭을 구현하는 함수의 집합(없으면 설치)


Apple에서도 제공하지만, Homebrew를 통해 관리도 가능 (gdbm, sqlite도 함께 설치)

~|⇒ brew install python


|➜  brew install postgresql



1) Qt website 에서 qt-opensource-mac-x64-clang-5.5.1.dmg 다운받아 설치 (default 옵션으로)

Homebrew에서  qt55가 /usr/local/bin에 symlink를 하기 위해


capybara webkit


Ruby 설치 (Apple에도 기본적으로 제공하지만…)

Miscellaneous graphical libraries -optional


Boost -optional

Boost 는 C나 C++ 프로그램을 한다면 설치할만 하다. (Libxml2를 먼저 설치한 후에~)


 MacTex ( MacTeX installer ,Latex  )

Rmarkdown문서를 PDF로 내보내기 위해 RStudio는 MacTeX가 필요하다. (가능하면 Full version으로 설치, 약 3GB필요)




Apache Ant –  Java library, command-line tool  (Java설치 필요)
Java (뿐만아니라, C 또는 C++) application 을 build하는 tool로 가장 많이 사용되며,
Java Application을 compile, assemble, test , run하는 일을 수행한다.

RStudio server 설치

github.com/Homebrew/ homebrew-science /blob/master/ rstudio-server.rb

 homebrew/science was deprecated!!

Add this tap and install rstudio-server

==> Installing rstudio-server from randy3k/r
==> Downloading https://github.com/randy3k/homebrew-r/releases/download/rstudio-server-1.1.442/rstudio-server-1.1.442_3.sierra.bottle.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/60392032/ded43734-2c61-11e8-82a9-b891eb8d2445?X-Amz-Algorithm=AW
######################################################################## 100.0%
==> Pouring rstudio-server-1.1.442_3.sierra.bottle.tar.gz
Warning: randy3k/r/rstudio-server dependency gcc was built with a different C++ standard
library (libstdc++ from clang). This may cause problems at runtime.
==> Caveats
- To test run RStudio Server,
    /usr/local/opt/rstudio-server/bin/rserver --server-daemonize=0

- To complete the installation of RStudio Server
    1. register RStudio daemon
        If it is an upgrade or the plist file exists, unload the plist first
        sudo launchctl unload -w /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist

        sudo cp /usr/local/opt/rstudio-server/extras/launchd/com.rstudio.launchd.rserver.plist /Library/LaunchDaemons/
        sudo launchctl load -w /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist

    2. install the PAM configuration
        sudo cp /usr/local/opt/rstudio-server/extras/pam/rstudio /etc/pam.d/

    3. sudo rstudio-server start

- In default, only users with id >1000 are allowed to login. To relax the
  requirement, add the following line to the configuration file located
  at `/etc/rstudio/rserver.conf`

==> Summary

To test run RStudio Server

/usr/local/Cellar/rstudio-server/버전/bin/rserver 와 /usr/local/Cellar/rstudio-server/버전/bin/rstudio-server는 
/usr/local/bin에 재Link된다

~|⇒ sudo /usr/local/opt/rstudio-server/bin/rserver --server-daemonize=0

로그 확인 /var/log/system.log 

To complete the installation of RStudio Server

1. register RStudio Server daemon

업그레이드를 했거나 이미 plist가 로딩되어 있다면, Unload 한다. (신규설치시 필요없음)

~|⇒ sudo launchctl unload -w /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist

~|⇒ sudo rm /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist

1) plist 서비스폴더에 복사 

“com.rstudio.launchd.rserver.plist”파일을 copy하여, own와 mod를 변경후에,  자동으로 서버가 시작되도록 컨텐츠를 추가한다. 

~|⇒ sudo cp /usr/local/opt/rstudio-server/extras/launchd/com.rstudio.launchd.rserver.plist   /Library/LaunchDaemons/

2)  plist 수정

~|⇒ sudo vi /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist 

1) rstudio 서버의 기본값으로 auth-minimum-user-id 는 1000 인데,  일반적으로  OS X user’s first ID 는 501이므로 ( the second user’s ID는 502 …) 아래와 같이 수정한다. replace 8번재줄부터




2) 부팅시 RStudio Sever 런칭 설정,  plist 파일 수정 (14번째줄)




2. install the PAM configuration

~|⇒ sudo cp /usr/local/opt/rstudio-server/extras/pam/rstudio /etc/pam.d/

— 또는 

~|⇒ sudo cp /etc/pam.d/ftpd         /etc/pam.d/rstudio
# login: auth account password session
auth       required       pam_opendirectory.so
account    required       pam_permit.so
password   required       pam_deny.so
session    required       pam_permit.so

3. 서비스 등록 (로딩)

~|⇒ sudo launchctl load -w /Library/LaunchDaemons/com.rstudio.launchd.rserver.plist

4. start rstudio-server

~|⇒ sudo rstudio-server start

참고> stop rstudio

~|⇒ sudo rstudio-server stop

5. 실행


참고>  “Invalid username/password” 에러 발생시 , rstudio PAM 을 설치다시 확인 


rstudio group 생성  (System Preferences -> Users & Groups -> Add)



~|⇒ sudo /usr/local/opt/rstudio-server/bin/rserver --server-daemonize=0
21 Dec 2016 07:30:08 [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 &) 
LOGGED FROM: int main(int, char *const *) 

Port 에러

1) 8787 Port 사용중인지 확인

~|⇒ sudo fuser 8787/tcp

fuser명령어는 특정파일을 어떤프로세스에서 사용하고 있는지 확인해야 할 필요성이 있을 때, 지정된 파일이 사용되고 있는 프로세스 ID를 확인하는 명령어로 지정된 파일과 PID를 KILL 또는 재시작 할 수도 있다.

2) kill all process.

~|⇒ sudo fuser -k 8787/tcp

Permissions 에러

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



Disable Pop-Up Blockers

There are a number of instances where RStudio needs to show a new external popup window (e.g to display a PDF file). We therefore recommend that you disable pop-up blocking for the RStudio domain. Most browsers will prompt you regarding whether you want to enable popups for RStudio the first time one is blocked. Some browsers (such as Safari) may require you to globally enable and disable popups.

Disable Browser Spell Checking

If you are using a browser with built-in spell-checking, you may find it desirable to disable “Check Spelling While Typing” (available from the Edit menu) since many of the words you enter in the Source and Console will not be in the built-in dictionary and thus will show up with a red underline when entered.





Categories: R Basic


Blog Owner

1 Comment

Leave a Reply

Your email address will not be published.