h1

OpenBUGS and WinBUGS on Mac OS X

June 15, 2009

I 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.

About these ads

16 comments

  1. 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!


    • I 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”.


  2. It 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 (0×10026,13,0×00000002,3): stub
    fixme: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 0×3


    • 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.


  3. Thank 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.


  4. rjags (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*)’:
    jags.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’


  5. While 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.


    • Michael, 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.


    • WinBUGS/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.


      • Hi Dave,
        I 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.


  6. Do you have instructions for installing JAGS?


    • Sure.

      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.


  7. Thanks 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…


  8. I seem to be missing the examples and manuals in openbugs. Any ideas where I left them??


  9. Thanks 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.



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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: