Using WinBUGS on an PPC OSX laptop connected to a Linux server
While R
is an excellent tool for a wide variety of statistical analyses, it’s not the only game in town. Practitioners of Bayesian statistics have a few other tools that complement R
nicely. One case where R
originally lagged was in offering a general-purpose MCMC sampler. That situation has largely changed, but there are still cases where you might want to look outside of the R
toolbox. In particular, certain Bayesian stats books are written with the assumption that exercises and examples can be executed in WinBUGS
. While there is (just) another Gibbs sampler that runs natively on OSX and linux, JAGS
can’t read WinBUGS
.odc
files.
Read on to see how I got WinBUGS
running on my PowerPC OSX laptop connect to a linux server.
A disclaimer: this worked for me without causing anything to explode (yet). I’m not responsible for whatever you happen to break by following these instructions. I’ll try to help if you get stuck, though.
The goal is to run WinBUGS
. Let’s cover some easy ways to do that.
- Use Windows. Download
WinBUGS
. Get the immortality key and follow its instructions. Problem solved. - If you have an Intel Mac, I would suggest that you just install
Wine
on your local machine using MacPorts. Instructions to do that can be found here. - If you are running Linux, use your package manager (
apt-get
on Debian-based systems,rpm
oryum
on Redhat-based systems, etc.) to installWine
andOpenBUGS
. If your package repositories don’t includeOpenBUGS
, you can follow the instructions below to download and installOpenBUGS
in Linux. - The brave amongst you may wish to try installing
Wine
locally on a PPC Mac. The Darwine project aims to make that possible. See this post to get started with Darwine. Note that the only version of Darwine for PPC Macs is quite old.
Assuming none of those options works for you, and you have access to a Linux server and a PPC Mac, you can follow the steps below to replicate my setup.
First we grab OpenBUGS
for our linux server:
ssh username@your-linux-server
mkdir src; cd src
wget http://www.mathstat.helsinki.fi/openbugs/OpenBUGS.zip
unzip OpenBUGS.zip
cd ~/src
Next, we download and install Wine (Wine Is Not an Emulator). This lets us run many Windows programs on Linux.
wget http://downloads.sourceforge.net/wine/wine-1.1.15.tar.bz2?use_mirror=internap
tar -xjvf wine-1.1.15.tar.bz2
cd wine-1.1.15
./configure --prefix=${HOME}
make depend && make
make check # be sure you have an X11 session started
make install
regedit &
If everything worked correctly, you should see the regedit
program from windows open on your X11
display. If you’re like me, though, you’re running OSX 10.4 on a PowerPC mac, and things didn’t work correctly. In my case, a normal looking Windows application opened, but there was no text in any of the menus or dialog boxes. Fonts seemed to be completely broken.
I took a couple of incorrect approaches that were probably harmless (like installing Microsoft CoreFonts), but eventually hit the solution. The OSX version of X11
(at least in 10.4) does not use the xrender
library for displaying graphics. We can tell Wine
not to use this library either. I found this fix on an Ubuntu forum.
NB: If you are interested in installing extra fonts, I think the best way is probably with winetricks. You’re on your own for that step.
On the Linux server, open a text editor (I use emacs
). Create a new file called no_xrender.reg
. The name and extension on this file don’t matter, but that name reminds me what the file is for (turning off xrender) and how to open it (with the regedit
program).
Copy these lines into your file. Save it and close it.
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]
"ClientSideWithRender"="N"
Now, still on the Linux server, run
wine regedit no_xrender.reg
This will helpfully display absolutely no output whether it works or not. Cross your fingers and run
regedit &
If that works you will see the regedit
application from Windows displayed with all of the proper text. If you’ve made it this far, then the OpenBUGS
version of WinBUGS
is just a few commands away.
cd ~/src/OpenBUGS/
wine winbugs.exe
And the big payoff: here’s a screenshot of one of Congdon’s examples from Bayesian Models for Categorical Data running on our remote linux server and being displayed on my trusty OSX 10.4 PPC laptop.
February 27, 2009 at 8:51 pm
For those running 10.5, you shouldn’t need to worry about disabling RENDER. With 10.5, Apple switched from XFree86 to X.org (including all the goodies like RENDER and DAMAGE support), plus they’ve been keeping up to date at XQuartz if you want to live on the bleeding edge.
LikeLike
February 27, 2009 at 9:00 pm
Drew–
Good point. The instructions for Darwine that I linked above (http://forum.winehq.org/viewtopic.php?t=3774&sid=cd19110add4afdfb08072e4023f16d8a) actually give a nice walkthrough for getting a recent version of Wine running on top of XQuartz. Unfortunately, I’m stuck with OSX 10.4 for now.
LikeLike
February 28, 2009 at 5:00 pm
Thanks for putting this up. Really useful. Andrew, can we install this to run nicely on all lab macs, too?
LikeLike
February 28, 2009 at 10:47 pm
Florian, #3:
We could install the current Darwine for Leopard (1.1.7 at the moment) on any Macs running 10.5, which currently is platypus, echidna, schleppi, and carry, but not lab1 and lab2. We could discuss later if it’s worth paying to upgrade the white iMacs to 10.5 (for reasons beyond this). OpenBUGS should run just as well on an intel Mac with Darwine as an intel Linux with Wine.
LikeLike
May 7, 2009 at 2:33 am
Dear all,
Many thanks for your site. I have a PPC with Tiger 10.4 and I have installed Darwine (It has been difficult: 10 days!). Now, all Darwine applications such as clock or regedit are functioning. However, I want to install Winbugs and when I make the command: “wine winbugs14.exe” in the terminal window, I have this message: “-bash: wine: command not found “(I am sure that I am in the good repertory, where winbugs14.exe is and the command ls see this file).
Have you an idea?
Many thanks,
Lili
LikeLike