Skip to content

Instantly share code, notes, and snippets.

@dennisprangle
Last active March 20, 2023 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dennisprangle/e26923fae7477566510757ab3341f54c to your computer and use it in GitHub Desktop.
Save dennisprangle/e26923fae7477566510757ab3341f54c to your computer and use it in GitHub Desktop.
JAGS installation notes

Here are some tips on installing JAGS on your own PC.

General advice

First you need to install the JAGS program:

Then install rjags R package. Within R, run install.packages ("rjags").

If this doesn't work, see the more specialised advice below. (I'll try to add more advice as particular issues come up.)

Mac permissions

When installing JAGS on a Mac you may receive an error message that the software cannot be installed because it comes from an unidentified developer. In this case go to System Preferences -> Security & Privacy -> General and select the option to proceed with the installation anyway.

Installation from source

In Windows/Mac, R may ask you whether to install the package from source e.g.

Do you want to install from sources the package which needs compilation?

It's recommended to answer "no". (This is because installation from source requires compilation of some C++ code, and you may need various tools to be set up to allow this to work correctly.)

Windows version issues

There is a recent version compatibility issue in Windows:

  • Recent versions of R (4.2.0 or later) only work with recent versions of JAGS (4.3.1 or later) and vice versa.
  • To use an earlier version of R, install version 4.3.0 of JAGS from SourceForge.

Note that from version 4.2.0, R only supports 64 bit PCs. So if you have an older 32 bit PC, you should keep using an old version of R.

M1 Mac advice (thanks to Jake Ireland)

Based on this thread:

  1. Install JAGS with homebrew (see https://brew.sh/ for instructions to install homebrew)
brew install pkg-config
brew install jags
  1. Overwrite the symbolic link for JAGS (necessary if you have other installations of JAGS)
brew link —overwrite jags
  1. Open R in the same terminal as the above commands were run using and run install.packages("rjags", type="source"). After the above, RStudio can be opened and everything works as required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment