Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Hi Folks,
for a research project I needed to install RApache on my Mac OS X 10.6.4 (Snow Leopard) machine.

It did take some time, a lot of beeping in the video documentary, a lot of recompiles…

Here is the way to do it:

1. Install Gnu Fortran on your Mac

You need to install Gnu Fortran on your Mac, because you have to build R on your Mac to run RApache.

Fortunately, there is a nicely Mac-style installer available at
http://gcc.gnu.org/wiki/GFortranBinaries#MacOS

2. Install libapreq on your Mac

tar xzvf libapreq2-2.12.tar.gz
cd libapreq2-2.12
./configure
make
sudo make install

3. Build R

Go to your favorite CRAN-mirror (Georg-August Universität Göttingen) and download the source for R, e.g. R-2.11.1.tar.gz (section source code for all platforms). Now build R. Watch out for the configure option –enable-R-shlib!

tar xzvf R-2.11.1.tar.gz

cd R-2.11.1
./configure --enable-R-shlib
make
sudo make install

4. Install RApache

Install RApache with the special configure option with-apache2-apxs!

tar xzvf rapache-1.1.9.tar.gz
cd rapache-1.1.9
./configure --with-apache2-apxs=/usr/sbin/apxs
sudo make
sudo make install

Go to your Apache configuration file:

cd /private/etc/apache2/
sudo pico httpd.conf

(if you have TextMate installed, just use sudo mate httpd.conf)

now add the line after the other LoadModule entries in the httpd.conf file

LoadModule R_module           libexec/apache2/mod_R.so


Add the following line for debugging just below

ROutputErrors


as well as (put this somewhere at the end of the conf-file:

# Prints out a nice report about R running within Apache
<Location /RApacheInfo>
SetHandler r-info
</Location>

Save httpd.conf.
Restart Apache (open up Systempreferences, select Sharing and uncheck and check Websharing).
Now you should be able to go to

http://yourcomputer/RApacheInfo
(you find the name of your computer in System preferences -> Sharing if you click on websharing: if websharing is running, it shows you a link to your computer – use the second link)

Have fun!

Update 8/11/2011
After that you have to reinstall R from CRAN again, because your regular R install will be broken. Hmmmm, I hope this gives all you RApache-Macheads enough headstart to come up with a cleaner solution.