OpenEMR Facebook Page OpenEMR Twitter Page OpenEMR Google+ Page OpenEMR Diaspora Page
OpenEMR Professional Support
Personal tools

OS-X Installation

From OpenEMR Project Wiki

Jump to: navigation, search

OpenEMR install on OS X 10.4.5


08/24/2008 Update: This is a really old tutorial I wrote several years ago. OpenEMR is now at v2.9.0 and FreeB is no longer required or used. I have since moved on from using OS X as the server platform to a dedicated linux box. My reason were several fold, but the big one was that mysql didn't perform as well on OS X Client under 10.4. This may have changed with 10.5 (as may have some of the steps to install) but I have not tried it.


BEFORE RUNNING THE MYSQL UPDATER LIKE YOU ARE ITCHING TO DO, EXECUTE THE FOLLOWING CRITICAL BACKUP PROCEDURE. IF YOU DON'T BACK UP THE MYSQL FOLDER FIRST YOU WILL LOSE YOUR ENTIRE DATABASE IN A NON-RECOVERABLE FASHION. IF YOU HAVE MUCH DATA THERE YOU WILL BE IN BOILING HOT WATER PAST YOUR EYEBALLS WITH LARGE CONCRETE OVERSHOES ON YOUR FEET AND PROBABLY TWO OR THREE 0.45 CALIBER SLUGS IN YOUR CRANIUM. YOU HAVE BEEN WARNED.


If you already have OpenEMR and mysql installed and running and you run an OS X mysql binary updater, it wipes out your data folder. I discovered this (and lost a day's worth of data... thankfully, I had just implemented a daily backup solution the week before) while trying to fix the mysql.sock error on the office machine when we did the 10.4.4 update a couple weeks ago. So, before running the mysql updater (on a previous install of mysql, not a new install) make sure to back up your data first. The easiest way to do this is with tar. So, from the system preferences, choose your mysql pane and stop the server.


Then, as root:
cd /usr/local/mysql
tar -cvf databackup.tar data


Now you have a clone of the data folder. Run the updater binary and go back to the mysql directory. Make sure the server is still stopped from the pref pane again (in case the installer started it). Rather than deleting anything (far safety), just rename the new data folder and untar your original data:


cd /usr/local/mysql
mv data data.bak
tar -xvf databackup.tar


Then, restart your mysql server from the pref pane. This is also a good time to back up the /webroot/openemr/documents/ folder. This very large folder repsresnts ALL of your scanned images.


EDITORS NOTE: Please note that as you read through this HOWTO, an orange circle with a question mark indicates a "new link" that is an artifact of the XOOPS "camel humping" rules. In this HOWTO ignore these orange circles, they aren't really part of the HOWTO and don't really mean anything (really).

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:

mv /Library/WebServer/Documents/openemr-2.8.1 /Library/WebServer/Documents/openemr

(This is an optional step one could leave the directory name as is openemr-2.8.1 and have your users point their browsers at the new web name openemr-2.8.1 instead of openemr)


Some of the permissions need to be fixed for OS X:
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 nano because it's easy so: nano /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.

BEFORE RUNNING THE MYSQL UPDATER LIKE YOU ARE ITCHING TO DO, EXECUTE THE FOLLOWING CRITICAL BACKUP PROCEDURE. IF YOU DON'T BACK UP THE MYSQL FOLDER FIRST YOU WILL LOSE YOUR ENTIRE DATABASE IN A NON-RECOVERABLE FASHION. IF YOU HAVE MUCH DATA THERE YOU WILL BE IN BOILING HOT WATER PAST YOUR EYEBALLS WITH LARGE CONCRETE OVERSHOES ON YOUR FEET AND PROBABLY TWO OR THREE 0.45 CALIBER SLUGS IN YOUR CRANIUM. YOU HAVE BEEN WARNED TWICE. PLEASE, BACK UP YOUR DATA!

Yes, I have intentionally repeated this critical warning for those of you who have skipped past the above listed critical warning. There is a reason that I used red ink. This is the color of your blood as it drips out of your body if you ignore this warning.

If you already have OpenEMR and mysql installed and running and you run an OS X mysql binary updater, it wipes out your data folder. I discovered this (and lost a day's worth of data... thankfully, I had just implemented a daily backup solution the week before) while trying to fix the mysql.sock error on the office machine when we did the 10.4.4 update a couple weeks ago. So, before running the mysql updater (on a previous install of mysql, not a new install) make sure to back up your data first. The easiest way to do this is with tar. So, from the system preferences, choose your mysql pane and stop the server.

Then, as root:
cd /usr/local/mysql
tar -cvf databackup.tar data

Now you have a clone of the data folder. Run the updater binary and go back to the mysql directory. Make sure the server is still stopped from the pref pane again (in case the installer started it). Rather than deleting anything (far safety), just rename the new data folder and untar your original data:

cd /usr/local/mysql
mv data data.bak
tar -xvf databackup.tar

Then, restart your mysql server from the pref pane. This is also a good time to back up the /webroot/openemr/documents/ folder. This very large folder repsresnts ALL of your scanned images.


OS X users with version numbers 10.4.3 or smaller should skip the following two commands. The paths were changed in 10.4.4 and higher in a way that breaks MySQL 4.*.

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

OS X users with version numbers 10.4.3 or smaller should resume the instructions here.

Now, we'll install the billing system.


I cribbed some of this from:
FreeB Installation

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

chown -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_LaserJet4. 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!


Author:
Frederick