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
Go ahead and install it.
2. Install libapreq on your Mac
libapreq2 is a library for your Apache 2 installation. Download libapreq2-2.12 (or newer) here and install it via Terminal:
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
Download RApache from http://biostat.mc.vanderbilt.edu/rapache/downloads.html
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
5. Reconfigure your Apache
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)
to get a nice info about RApache running on your system.
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.
7 Kommentare:
Hey Karsten,
great guide how to install all the necessary stuff to get RApache to run on Mac OS. I just copied the lines you posted and it worked out perfectly!!
Maybe one minor imprpvement: For someone who is not familiar with the Apache config file its hard to tell at what point in the file to add in the lines from you post. To avoid this uncertainty: could you add a a small explanation where to put each line of code in the Apache config file?
Great post!
Grüße,
Mark
Hi Mark,
thanks for the feedback. I added the info about where to put the lines into the Apache config file.
There is one problem right now: your standard R installation is broken after doing everything like this. I try to resolve this :(
Hi there,
great post, I will wreck my R now too :) . Is it difficult to get it back or is simply re-intalling enough?
best
matt
Hi, I made a script to automate the R(Apache) installation on Mac OS 10.6 in case somebody is interested: https://github.com/tregoning/RApache-Installer/blob/master/install-rapache.sh
hi John,
thanks for the RApache-Installer / install-rapache.sh script. It works flawless for 1.1.14.
However, I didn't manage to use it to update RApache to 1.1.15 using your script, although no error message appears.
(I corrected the line 73 to the new download URL
curl -O http://rapache.net/rapache-1.1.15.tar.gz)
Any comments would be highly appreciated,
Maciej
Hi John,
My installation seems to have worked, but when I load a web page, I get <%print(rnorm(10));%> as output instead of output from R. I'm not quite sure what diagnostics to provide, but if you would help me, I would greatly appreciate it. Thanks in advance.
Hi, I am trying to install it on MAC 10.9 and in step 2, when I run make, I get the following error:
Making all in c
source='apache_cookie.c' object='apache_cookie.lo' libtool=yes \
depfile='.deps/apache_cookie.Plo' tmpdepfile='.deps/apache_cookie.TPlo' \
depmode=none /bin/sh ../depcomp \
/bin/sh ../libtool --mode=compile gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"libapreq\" -DVERSION=\"1.2\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -I. -I. -I/usr/local/apache/include -g -O2 -c -o apache_cookie.lo `test -f 'apache_cookie.c' || echo './'`apache_cookie.c
/bin/sh: ../depcomp: No such file or directory
make[1]: *** [apache_cookie.lo] Error 127
make: *** [all-recursive] Error 1
any insight how to resolve this issue.
Kommentar veröffentlichen