fred0 wrote on Sunday, February 26, 2006:
OpenEMR install on OS X 10.4.5
Last summer, the cobbled together office management software that we had been using to run our clinic finally started to break down and I began searching for a solution. Everything was way too expensive for a small clinic such as we had and I finally came across OpenEMR. The old system was a bunch of Windows machines I had built myself (per the requirements of the software at the time). I desperately wanted to trash them and move the office to Mac OS X to get away from blue screens and the hundreds of viruses and spyware I would find every couple of weeks (plus, I have been a Mac system admin for over a decade).
I bought a Mac Mini and decided to give it a shot. It worked, but only after I spent about a week trying to figure it out. I slowly pieced together from various sources all the bits of installation and troubleshooting tips and got it running. I have since made some mods to the hcfa form to match our Xerox printer better, but other than that it was pretty much a standard install.
Today, I am preparing to upgrade from the install from last year to the 2.8.1 release and decided to refresh myself by doing it from scratch on a test machine and documenting the process this time. So, here, for anyone interested in running OpenEMR on the BEST and most friendly commercial unix platform out there, I present complete instructions.
First, download the parts you need.
From here at sourceforge:
openemr-2.8.1
freeb-0.11
From mysql.com
mysql 4.1.18 (standard)
There is a 64-bit version as well. This is for G5 systems.
I haven’t tested it, but from everything I read, v5 it doesn’t work well with openemr.
It’s not too obvious how to find older versions, so, this is the url (as of today);
http://dev.mysql.com/downloads/mysql/4.1.html
The package from mysql.com is a set of binary installers that run from the OS X gui.
Just double click on the icons for each of the 3 parts to install them. When you double click on the pref pane item, choose install for all users. That way, if you have multiple accounts, you can get to the pref pane from all of them.
From here on out, I am working as root on the command line. I am going to assume that you already know how to work on the command line. You can either enable the root user (it’s not by default on OS X for security reasons) through the NetInfo Manager app found in the Utilities folder in side Applications, or just preface every unix command below with sudo. I suggest making your life easier and enabling root. Just disable it when you’re done.
Unzip and untar openemr, and place it in /Library/WebServer/Documents
gunzip openemr-2.8.1.tar.gz
tar –xvf openemr-2.8.1.tar
mv openemr-2.8.1 /Library/WebServer/Documents/
Rename it from openemr-2.8.1 (or whatever) to just “openemr”
/Library/WebServer/Documents/
mv /Library/WebServer/Documents/
openemr-2.8.1 /Library/WebServer/Documents/
openemr
Set some permissions that are wrong:
chown –R root.admin /Library/WebServer/Documents/openemr
chmod –R 777 /Library/WebServer/Documents/openemr/interface/main/calendar/modules/PostCalendar/pntemplates/cache
chmod –R 777 /Library/WebServer/Documents/openemr/interface/main/calendar/modules/PostCalendar/pntemplates/compiled
Edit /etc/httpd/httpd.conf using your fav editor (I use pico ‘cause it’s easy so: pico /etc/httpd/httpd.conf) and uncomment these lines (probably don’t need perl, but what the heck):
LoadModule perl_module libexec/httpd/libperl.so
LoadModule php4_module libexec/httpd/libphp4.so
and
AddModule mod_php4.c
AddModule mod_perl.c
Edit the globals.php file to define the server root:
pico /Library/WebServer/Documents/openemr/interface/ globals.php
change line 10 from:
$webserver_root = "/var/www/html/openemr";
to
$webserver_root = "/Library/WebServer/Documents/openemr";
Optional globals (there are more, you should go through and read the file):
1. The default timeout to automatically logout idle users is 60 minutes. To change this, on about line 87 in the globals.php file, change the value from 3600 (expressed in seconds) to some thing larger. I used 7200 to make it 120 minutes.
2. You can define the time of day to start and end your schedule. The defaults are 8am-5pm. You can change these on about lines 109/110.
3. You can define the time intervals for your schedule on the lines just below the time of day stuff.
Finally, 10.4.4 changed the location of mysql.sock from the one openemr needs so:
mkdir /var/mysql
ln -s /tmp/mysql.sock /var/mysql/mysql.sock
Now, we’ll install the billing system.
I cribbed some of this from: http://www.oemr.org/modules/wiwimod/index.php?page=FreebInstall&back=WiwiHome
First, install Xcode Tools from Tiger DVD. This provides all the developer stuff you will need to compile from source.
Unzip and untar freeb
gunzip freeb-0.11.tar.gz
tar –xvf freeb-0.11.tar
Rename it from freeb-0.11 (or whatever) to freeb
mv freeb-0.11 freeb
Move the freeb directory to /usr/share
mv freeb /usr/share
Set permissions
chmod –R root.wheel /usr/share/freeb
Download expat from http://sourceforge.net/projects/expat/
Untar it and compile:
gunzip expat-2.0.0.tar.gz
tar –xvf expat-2.0.0.tar
cd expat-2.0.0
./configure
make
make install
Next, run cpan, choose defaults for all questions by hitting enter until you get to the part which asks for your geographical location, when asked for a list of servers, choose several. I chose the first 9.)
When that’s done, you will get the cpan command prompt that looks like:
cpan>
While we’re here, we’ll upgrade cpan first (this part is not necessary so, you could skip it if you’re impatient). This will take a while and you should just accept the defaults hit enter anytime it asks you anything:
cpan> install Bundle::CPAN
cpan> reload cpan
Now install the modules for freeb, hit enter to accept defaults for any questions asked:
cpan> install XML::Parser
cpan> install HTML::Tagset
cpan> install HTTP::Daemon
cpan> install PDF::Create
cpan> install ConfigFile
cpan> install Date::Calc
cpan> quit
Test that you don’t get any errors with:
/usr/share/bin/ FreeB_Server.pl
It should simply return:
before server setup
Hit ctrl-c to cancel and get back to the command line.
Now, create startup daemon for freeb:
pico /Library/LaunchDaemons/com.freeb.Freeb.plist
paste this into the window and then ctrl-x to exit and save:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.freeb.Freeb</string>
<key>OnDemand</key>
<false/>
<key>Program</key>
<string>/usr/share/freeb/bin/FreeB_Server.pl</string>
<key>ProgramArguments</key>
<array>
<string>/usr/share/freeb/bin/FreeB_Server.pl</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceDescription</key>
<string>Freeb Server</string>
<key>UserName</key>
<string>root</string>
<key>WorkingDirectory</key>
<string>/usr/share/freeb</string>
</dict>
</plist>
Now set permissions on the daemon:
chown admin.staff /Library/LaunchDaemons/com.freeb.Freeb.plist
chmod 666 /Library/LaunchDaemons/com.freeb.Freeb.plist
Reboot and freeb is started automagically.
In order to print claims, you will need to edit the config.php file
pico /Library/WebServer/Documents/openemr/includes/config.php
and add your printer name in place of where it says “HP_LaserJet4L”.
This is tricky because you need the unix name for the printer. You can find it by opening http://127.0.0.1:631 and then clicking on Manage Printers. The unix name will be the one at the far left of the title bar. Alternately, open the Printer Setup Utility, highlight your printer and click Show Info. Under the section called Queue Name is the proper unix name you need.
Now, to simplify processing of bills, I created a little program to trigger the process_bills.php action by simply clicking on it. That way, my users don’t have to muck around on the command line. Using Apple’s Automator program, I added the Run Shell Script action with the following command:
php -q /Library/WebServer/Documents/openemr/library/freeb/process_bills.php bill
and then saved it as an Application and named it Process Bills.
That’s it!