Installing R and JAGS on Apple Mac OS

HOME I don't have an Apple computer, but I have picked up some hints about installing R and JAGS on a Mac from trying to trouble-shoot friend's installations. 10 June 2016: I now do have a Mac!

People seem to run into problems with different versions of the Mac OS, R, JAGS and the rjags package. The only way to stay sane is to use recent versions of all four.

Check your Mac OS version!

From the Apple menu, choose About This Mac; the version number appears below the name. Note whether you have v. 10.9 (Mavericks) or later. If you have an earlier version, upgrade your OS before going further.

R

The latest version of R (R 3.3.3 as at 19 March 2017) is only available for OS X 10.9 or later. Don't try to install it on older versions.

If you have OS X 10.6 - 10.8, you can still install an old version of R, 3.2.1, but be prepared to sort out the tangle of compatibility issues which result.

Installers for new and old OS's are here; be sure to select the right one for your machine.

When you open R, you may get a slew of warnings:

During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_COLLATE failed, using "C"
  ...
WARNING: You're using a non-UTF8 locale, therefore only ASCII characters will work.
Please read R for Mac OS X FAQ (see Help) section 9 and adjust your system preferences accordingly.

This needs to be fixed, or R will have problems reading the package code. For instructions on how to fix it, look at Section 7 of the help file suggested in the message or go to Stackoverflow.

JAGS

The latest version of JAGS (JAGS 4.2.0) also requires OS X 10.9 or later. Do not try to install it on older versions

The older version of JAGS (JAGS 3.4.0) is still available, but only use that if you want a complicated life.

JAGS does not appear in Applications. To check that it's installed properly, open the Terminal and type "jags". You should get a message telling you which version is installed. Type "exit" to close JAGS. If you tried to install JAGS 4 on an old OSX, you will get an error message.

The rjags package

You need rjags to access JAGS from R. The R2jags and jagsUI packages depend on rjags, so you will get similar messages if you try to install R2jags or jagsUI.

If you have recent versions of your OS and R, and JAGS version 4.2.0 or later, it's easy: install rjags within R by running install.packages("rjags").

If you have old versions, you will have to tinker. To begin with JAGS 3 requires rjags 3-15. You can get the source code from the CRAN archive and install from source. The rjags source includes C code, so you may need to install the XCode tools. You should install the coda package that rjags depends on before installing rjags from source.

Updated 19 March 2017 by Mike Meredith