rjags 3 for Mac OS X

R package rjags-3_5 is now available for Mac OS X.  You need to install  JAGS version 3.1.0 , then install the rjags package in the usual way from within R.

There are some restrictions, you need to be running R 2.13.0 or above (and to keep up to date you should be running 2.14.0) and the package is only built for sub-architecture i386.

Thanks to Bill Northcott, who provides the JAGS installers, and Simon Urbanek, who produces the R binary packages for Mac OS X.


28 thoughts on “rjags 3 for Mac OS X

  1. I’ve a bit of a problem with the package provided here. It installs, but doesn’t appear to put any libjags.3.dylib in /usr/local/lib and so when loading the rjags package in R it fails because it can’t load that library.

    Any ideas?

      • Thanks for coming back so quickly Martyn. I’ve been looking at it since my first post and think I have discovered the problem, which I believe to be a bug in the Mac installer.

        Basically, the Mac installer linked in the post is installing everything into subdirectories of /local instead of subdirectories of /usr/local … consequently rjags is understandably not finding it in the system paths!

        I’m just about to try manually copying all the files into the correct locations to see if that fixes it, in which case it is an easy fix just to correct the install location for the Mac installer. Will report back ASAP!

      • No problem, happy to answer any queries. I’ve just confirmed that moving the files manually to /usr/local worked a treat … rjags loads without errors now! This means it is a simple matter of the installer putting the files in the wrong directory; the files themselves are fine.

    • I had the same problem. I had used macports to install jags v3.2 and subsequently tried to install rjags. The error above occurred on calling library(rjags). I uninstalled both the macports jags and rjags, then installed the jags v3.1 from its .dmg file. rjags installed/worked perfectly after that

  2. Nobody else has reported this. Bill has double-checked that the installer works correctly. It looks like a problem with your set up, possibly a strange symbolic link in your file system.

    • Ok, that’s pretty strange. I do lots of development on this machine so I think I’d have spotted quirky symlinks and a manual cp to the right directories didn’t loop back on itself, but as long as it only happened to me it doesn’t matter!

      Thanks for a great Bayesian analysis tool!

      • Louis, I am not sure I find the usr folder… I’m afraid it may be one of those files that Mac keeps invisible… how can I access it? Thanks!

      • I used the Terminal, because you don’t have any issue with hidden folders there. So you just need to cd into the /local directory and look for the JAGS files which need to be moved and send them over to the corresponding subdirectories of /usr/local

        HTH, Louis

    • I had the very same problem, and moving the files manually to user/local solved it. I was very glad to find this discussion posted.

  3. You’re not the only one! I have run into the same problem and a student of mine just reported she can’t load rjags from R after installing new versions of everything. I will try copying the files to the correct directory. Thanks Louis!

  4. OK, after the comments by Megan and Greg this is obviously not a one-off. If you do have this problem, can you please give details on your installation: i.e. version 10.x, Intel or PowerPC, 32-bit or 64-bit? Thanks.

    • Here is some info about my installation:
      Version 10.5.8, Intel with R 2.14.0 GUI 1.42 Leopard build 32-bit (5933)

      And, it did work fine after manually moving the files, as Louis suggested.

      Thanks for all your work Martyn and Bill!

      • I think it must be Leopard. Note that the Mac OS X binary distribution of R is likely to drop support for Leopard soon (although the next R release is not scheduled) so you should consider upgrading.

  5. Hi, I get the following warning when trying to install the package provided here. The file is sitting in my downloads folder. Sorry if this is a stupid question but I tried to move the files to a number of places according to this thread and nothing worked. What can I do?

    > install.packages(“rjags_3-5.tar.gz”,repos=NULL)
    tar: Error opening archive: Failed to open ‘rjags_3-5.tar.gz’
    Warning messages:
    1: ‘tar’ returned non-zero exit code 1
    2: In file.rename(file.path(tmpDir, pkgname), instPath) :
    cannot rename file ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/file8a64e9a3dd8/rjags’ to ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/rjags’, reason ‘No such file or directory’
    3: unable to move temporary installation ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/file8a64e9a3dd8/rjags’ to ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/rjags’

      • But I get a similar warning with the binary:

        tar: Error opening archive: Failed to open ‘rjags_3-5.tar’
        Warning messages:
        1: ‘tar’ returned non-zero exit code 1
        2: In file.rename(file.path(tmpDir, pkgname), instPath) :
        cannot rename file ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/file29af9907c2/rjags’ to ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/rjags’, reason ‘No such file or directory’
        3: unable to move temporary installation ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/file29af9907c2/rjags’ to ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/rjags’

      • Thank you Martyn. Problem solved with


        I had incorrectly assumed that the package downloaded from this site would be more recent that the one available from the command line. Then I tried install.packages(“rags-3_5”) and that didn’t go well.

        Note however that the CRAN link to the extension “tgz” file results in an extension “tar” file. Could this be a mistake? I tried several times: clicking on the tgz file option always lead to a tar file appearing in my downloads folder. Thank you for your help.

  6. Hi,
    I’m trying to install rjags for the first time. I’m using mac 10.6.8. I have installed jags 3.1.0, and tried install.packages(“rjags”) which produced the error:

    Warning: unable to access index for repository http://www.stathy.com/cran/bin/macosx/leopard/contrib/2.13
    Warning message:
    In getDependencies(pkgs, dependencies, available, lib) :
    package ‘rjags’ is not available (for R version 2.13.2)

    I also installed R version 2.14.2, which gave the same error.

    Any suggestions? Thanks very much!

  7. I ran into a problem. I tried installing jags using MacPorts:

    sudo port install jags

    then install rjags using R:


    You get an dll error. The problem seems to be that MacPorts puts things into /opt/local/lib while rjags wants things in /usr/local/lib. I copied and symlinked the relevant files, which seems to have fixed things, but this problem really should be fixed at the install level.

  8. Pingback: Locating files in terminal on mac « ecology & stats

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s