Here are some tips on installing JAGS on your own PC.
First you need to install the JAGS program:
- Windows/Mac: download installer from https://sourceforge.net/projects/mcmc-jags/files/
- Linux: see details at http://mcmc-jags.sourceforge.net/
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.)
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.
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.)
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.
Based on this thread:
- Install JAGS with homebrew (see https://brew.sh/ for instructions to install homebrew)
brew install pkg-config
brew install jags
- Overwrite the symbolic link for JAGS (necessary if you have other installations of JAGS)
brew link —overwrite jags
- 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.