Setting up FastRWeb on Mac OS X

[This article was first published on Rronan » R, 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.

FastRWeb is an infrastructure that allows any webserver to use R scripts for generating dynamic content, such as web pages and graphics.

In this post, you’ll learn how to install and set up FastRWeb on a Mac. This tutorial is expendable to any Unix-like operating system. It is an adaptation from Jay Emerson’s post, Setting up FastRWeb/Rserve on Ubuntu.



Even if not required, I recommend installing the latest version of the XML package. An older version may cause a dysfonction. You should install it from sources.

R CMD INSTALL XML_3.93-0.tar.gz

Cairo is a graphics device for R which uses the cairo graphics library. You can easily install it using MacPorts or Fink. In the terminal, install Cairo from sources.

R CMD INSTALL Cairo_1.5-1.tar.gz

I use the Apache HTTP Server from XAMPP because it comes pre-configured to run CGI scripts. You may want to use the server pre-installed on Mac OS X. Then, you will have to configure it to run CGI scripts.

Installing Rserve

To install Rserve, you have to use a recent version of R (≥ 2.0.0). As the other packages, you should install it from sources.
You will need administrator privileges to install it.

sudo R CMD INSTALL Rserve_1.7-0.tar.gz

If the installation is okay, try to run Rserve in R.


Installing FastRWeb

As the other packages…

sudo R CMD INSTALL FastRWeb_1.1-0.tar.gz

FastRWeb isn’t a simple R package, it is an environment for servers to run R scripts. To do this, you must go to the folder where is the FastRWeb package.

cd `echo 'cat(system.file(package = "FastRWeb"))' | R --slave`

FastRWeb privides a sample script that sets up the environment. You can run it like this:

sudo sh

FastRWeb will be installed in /var/FastRWeb/.

Now you can copy the CGI program named Rcgi which is in the directory cgi-bin of the package to the directory cgi-bin of the server. You’ll have to use the administrator privileges.

sudo cp cgi-bin/Rcgi /Applications/XAMPP/xamppfiles/cgi-bin/R

Starting the server

Now, you can run the Apache HTTP Server with XAMPP Control.

open -a /Applications/XAMPP/XAMPP\

Start Rserve with the administrator privileges.

sudo /var/FastRWeb/code/start

Try the example

There are examples of R scripts in /var/FastRWeb/web.R/. You can try them here:

If you can see the examples, you can start developping your own scripts.

Stopping Rserve

To stop FastRWeb/Rserve.

sudo killall -INT Rserve

Removing sources

You may want to remove sources.

rm XML_3.93-0.tar.gz Cairo_1.5-1.tar.gz Rserve_1.7-0.tar.gz FastRWeb_1.1-0.tar.gz

Licence Creative Commons

To leave a comment for the author, please follow the link and comment on their blog: Rronan » R. 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)