OpenBUGS and WinBUGS on Mac OS X
June 15, 2009I haven’t found a really good how-to for getting OpenBUGS and WinBUGS up and running on Mac OS X, so I thought I’d create a little how-to. Setting up these programs is super easy but requires MacPorts and wine .
First, you need to have the Xcode developer tools installed. Go to Apple, create an account, and download them.
Second, install MacPorts (get it here for 10.5) by clicking the *.dmg file.
Third, open a terminal and type:
sudo port install wine
This will take about 20 minutes to compile wine and all its dependencies.
Fourth, download the WinBUGS zip file here and the OpenBUGS zip file here .
Fifth, unzip the WinBUGS file by double clicking on it and it will create a folder called WinBUGS14. Move this to Applications. For OpenBUGS, I had to create a folder called OpenBUGS, move the zip file there, open up a terminal, and type unzip OpenBUGS.zip
(double clicking this file did not work thus I fired up a terminal). This folder I then moved to Applications.
Sixth, to start WinBUGS open a terminal and type the following:
cd /Applications/WinBUGS14
wine WinBUGS14.exe
For OpenBUGS, open a terminal and type the following (assuming you created a folder named OpenBUGS with all the file from the OpenBUGS.zip files in them):
cd /Applications/OpenBUGS
wine winbugs.exe
Everything seems to work fine. The only thing I’ve noticed is that the fonts are not as nice in wine as they are in Windows and in WinBUGS some of the documentation doesn’t work properly (e.g. clicking on links does nothing), whereas in OpenBUGS they work flawlessly.
Please leave comments if this works/doesn’t work for you.
EDIT June 1st 2010
I see that lots of people have been coming here to learn how to install OpenBUGS and WinBUGS on Mac OS X. What I would like to do is to encourage you to use JAGS and rjags instead of *BUGS. It is very similar to *BUGS, can do nearly the same things as *BUGS, and is opensource. So please consider JAGS instead of *BUGS.
Thanks for providing this information. It didnot work on 10.6, and I found other instructions here: http://davidbaumgold.com/tutorials/wine-mac/
Now, what I’m trying to do is to launch OpenBUGS from R, and I have no success. Is it something that you have tried? Thanks!
by Guillaume December 23, 2009 at 1:12 amI haven’t tried launch OpenBUGS from R. But I would imagine you can do this if you specify the correct path. Something like wine “/path/to/winbugs.exe”.
by Desjardins December 27, 2009 at 6:08 pmIt did not work for me. I installed wine, and the WinBugs window did pop up after I typed “wine WinBUGS.exe”, but I got the following error message. You have any idea how to fix this?
fixme:keyboard:RegisterHotKey (0x10026,13,0×00000002,3): stub
by Wayne January 21, 2010 at 1:50 amfixme:ole:GetHGlobalFromILockBytes cbSize is 13824
err:ole:CoGetClassObject class {0003000a-0000-0000-c000-000000000046} not registered
err:ole:CoGetClassObject class {0003000a-0000-0000-c000-000000000046} not registered
err:ole:CoGetClassObject no class object {0003000a-0000-0000-c000-000000000046} could be created for context 0x3
Did you try Guillaume’s link? I no longer use Mac OS X, so unfortunately I can’t really troubleshoot. Maybe somone that reads this will.
by Desjardins January 24, 2010 at 3:24 pmThank you very much for sharing the info. I gave up using trying to use xBUGS when I realized (i) “OpenBUGS” was for Windows, not Linux, (ii) when I realized JAGS would run on both my Linux and Mac machines, and (iii) I found rjags and R2jags packages make using JAGS a snap.
If there is a reason to go back to xBUGS (and I imagine there may well be), I thank you for your help page.
by Hank Stevens January 24, 2010 at 11:32 amrjags (and hence R2jags) is not compiling for me on Snow Leopard – any hints?
Here is the error message:
jags.cc: In function ‘SEXPREC* set_default_monitors(SEXPREC*, SEXPREC*, SEXPREC*)’:
by mp4man May 8, 2010 at 11:10 pmjags.cc:427: error: ‘class Console’ has no member named ‘setDefaultMonitors’
jags.cc: In function ‘SEXPREC* clear_default_monitors(SEXPREC*, SEXPREC*)’:
jags.cc:444: error: ‘class Console’ has no member named ‘clearDefaultMonitors’
jags.cc: In function ‘SEXPREC* get_monitored_values(SEXPREC*, SEXPREC*)’:
jags.cc:456: error: no matching function for call to ‘Console::dumpMonitors(std::map<std::basic_string<char, std::char_traits, std::allocator >, SArray, std::less<std::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits, std::allocator >, SArray> > >&, std::map<std::basic_string<char, std::char_traits, std::allocator >, unsigned int, std::less<std::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits, std::allocator >, unsigned int> > >&, const char*)’
/usr/local/include/JAGS/Console.h:192: note: candidates are: bool Console::dumpMonitors(std::map<std::basic_string<char, std::char_traits, std::allocator >, SArray, std::less<std::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits, std::allocator >, SArray> > >&, const std::string&, bool)
make: *** [jags.o] Error 1
ERROR: compilation failed for package ‘rjags’
* removing ‘/Library/Frameworks/R.framework/Versions/2.11/Resources/library/rjags’
What version of rjags are you trying to compile? What verision of JAGS do you have? The version of rjags on CRAN will not work with JAGS 2.0.0.
Also, maybe this link might be of interest, http://www.r-project.org/nosvn/R.check/r-release-macosx-ix86/rjags-00check.html It looks rjags, at least a binary, can’t currently be built on Mac OS X.
by Desjardins May 9, 2010 at 1:19 pmWhile JAGS and the rjags package are nice, and remove the need for all that tedious data and result shuffling between xBUGS and R, I’ve run into quite a few subtle problems involving model code that WinBUGS runs quite happily but JAGS rejects (usually with an quite uninformative error message). So, at least for the moment, I’ll still be running WinBUGS under wine / Crossover.
by Michael Bedward June 29, 2010 at 8:43 amMichael, when you get errors do you report them to Martyn Plummer with some data that replicate the error? That is the the only way that JAGS can improve.
by Desjardins July 1, 2010 at 2:14 pmWinBUGS/OpenBUGS’s implementation of the BUGS language is also different from JAGS’s in some pretty substantial ways – most notably, the I(,) notation for truncated/censored/prior ordered data doesn’t exist in JAGS (but there are other ways to get the same effects), and the cut() function isn’t implemented at all. There’s a section of the JAGS manual that discusses these differences.
by Dave September 24, 2010 at 2:08 amHi Dave,
by Desjardins September 24, 2010 at 2:25 amI nearly always use JAGS when via rjags when I need to do a Bayesian analysis. So I don’t really know about using the R packages to interact with *BUGS sorry. I do know that you can do it in Linux with Wine and I wonder if r2winbugs would work on a Mac.
Do you have instructions for installing JAGS?
by mcihaelmenke July 27, 2010 at 7:56 pmSure.
1) Download the Mac OS X JAGS 2.1.0 image by clicking here
2) Install the .dmg like you would any other Application (e.g. Firefox)
3) Install rjags or R2jags
3a) Open R
3b) then run the following:
install.packages("rjags")
install.packages("R2jags")
I am not familiar with R2jags but rjags works nicely.
by Desjardins July 27, 2010 at 8:52 pmThanks for the info, it was quite helpful getting the OpenBUGS GUI up and running. I’d like to know if you have any suggestions (or can point me towards any good resources) for getting the R interfaces up and running, something I’ve had little success with so far. BRugs is no longer maintained on CRAN, and rbugs hasn’t been tested or well-documented on Mac OS X. I’ve done a fair amount of fiddling around with the parameters of the rbugs() function but am not able to find the magic combination to make it work…
by Dave September 24, 2010 at 2:05 amI seem to be missing the examples and manuals in openbugs. Any ideas where I left them??
by michael menke October 13, 2010 at 3:08 amThanks for these tips. I posted a short and easy how-to on my website (https://sites.google.com/site/matthewgiovanni/) for using Wineskins (based on WINE) to run OpenBUGS (or WinBUGS) in Mac OS X 10.6. So far, no problems, and Wineskin is a great open-source app.
by Matt Giovanni February 25, 2011 at 8:21 pm