Mac-native GNUmed

Introduction

Installing GNUmed under Apple's Mac OS currently requires, in addition to several software packages listed lower down,

  • OS 10.6 or higher
  • PostgreSQL 9.1 or higher (9.3.x recommended)
  • gcc for compilation of psycopg2
  • comfort and familiarity with the use of the Terminal app, which can be found in the /Applications /Utilities folder

While Mac OS 10.8 comes with python 2.7 installed, it is wise to install an external python because Apple sometimes modifies the system python.

Caveats before proceeding:
  1. these instructions are provided without warrantee
  2. prior to production use, carefully assess all of your privacy, security, redundancy and downtime requirements

Preparation

Advance checking

Run through the following checks for what is often lacking or inadequate on 'stock' Apple machines. Open a Terminal session and …

1. Check your $PATH

$ echo $PATH

The Mac OS default is typically /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin whereas after having installed an external python framework it should typically be like /Library/Frameworks/Python.framework/Versions/2.7/bin.

2. Check whether gcc is installed… it will be needed for installing/compiling psycopg2:
$ which gcc
    ...

If nothing is returned, you probably lack Command Line Tools … you can confirm the lack of a receipt thereof, using the command pkgutil --pkg-info=com.apple.pkg.DeveloperToolsCLI.

Obtain Command Line Tools by registering a free Apple Developer account and by using the methods at

If, for some reason, CLT needs to later be uninstalled, then see

There is no need to have Xcode if you are not developing, however to check whether it, too, is installed you can use either of the following commands, which should return a version:
  • xcode-select
  • /Developer/usr/bin/xcodebuild

CAVEAT if you are using Command Line Tools, do not also use the third-party OSX-GCC-Installer

3. Check the output of 'locale' … it should be something like the following, suited to your own language and locale:

$ locale
    LANG="en_CA.UTF-8"
    LC_COLLATE="en_CA.UTF-8"
    LC_CTYPE="en_CA.UTF-8"
    LC_MESSAGES="en_CA.UTF-8"
    LC_MONETARY="en_CA.UTF-8"
    LC_NUMERIC="en_CA.UTF-8"
    LC_TIME="en_CA.UTF-8"
    LC_ALL=

otherwise, see the Appendix to take care of this.

4. Check which pythons exist under /usr/bin, and which appears earliest in PATH, and its version
$ ls -al /usr/bin/python

$ which python

$ python --version

The active python should be like /Library/Frameworks/Python.framework/Versions/2.7/bin which is the minimum to support wxPython ≥ 2.9.x. More about Python is in the Appendix.

5. Check, in python, whether anyone had already installed psycopg2 and mx.DateTime on this machine. Each import line should, without error, return a new python prompt >>

$ python
    import mx.DateTime
    import psycopg2
    quit()

Minimum downloads

Download at least the following:

   python (python-2.7.5-macosx10.6 selected) –  from python.org as dmg
   wxpython (wxPython2.9-osx-2.9.5.0-cocoa-py2.7 selected) – from wxpython
   mxDateTime (egenix-mx-base-3.2.6-py2.7_ucs2-macosx-10.5-x86_64-prebuilt elected)
   postgres (postgresql-9.3.1-osx selected) – from EnterpriseDB
   psycopg2 (psycopg2-2.5.1 selected)

Procedure


install python 2.7
 
install wxpython 2.9.5 cocoa
 
install egenix mxBase as follows:
   cd /Users/maverick/Downloads/egenix-mx-base-3.2.6-py2.7_ucs2-macosx-10.5-x86_64-prebuilt/
   /Users/maverick/Downloads/egenix-mx-base-3.2.6-py2.7_ucs2-macosx-10.5-x86_64-prebuilt/setup.py install
 
install PostgreSQL

export PATH=/Library/PostgreSQL/9.3/bin:$PATH
sudo ln -s /Library/PostgreSQL/9.3/lib/libssl.1.0.0.dylib /usr/lib
sudo ln -s /Library/PostgreSQL/9.3/lib/libcrypto.1.0.0.dylib /usr/lib
sudo ln -s /Library/PostgreSQL/9.3/lib/libcrypto.dylib /usr/lib

cd /Users/maverick/Downloads/psycopg2-2.5.1
python /Users/maverick/Downloads/psycopg2-2.5.1/setup.py install
 
verify with:

python
> import psycopg2
> quit()

Download and untar the GNUmed client tarball

the Mac version needs adjustments before being able to run it.
the check is broken for wxpython 2.9 on Mac, fix this by:
   In the client wxpython folder, find gmGuiMain.py
   Go to line 30 where it says "3rd party libs"
   Comment out the last lines in that block ( wxversion.ensure.....)
   Save the file

cd /Users/maverick/Downloads/gnumed-client.1.3.9/client/
/Users/maverick/Downloads/gnumed-client.1.3.9/client/gm-from-vcs.sh

The above should work. Adjust values in =gm-from-vcs.conf= as may be desirable.

More downloads

LaTex support

BasicTex? (mactex-basic.pkg) requires just 87 Mb compared to 2.2 Gb for MacTex?, and is obtainable here. It ships with the very helpful command line utility tlmgr (TexLive Manager). The latter is documentedhere.

BasicTex? lacks some of the packages needed by base GNUmed, for example the file utf8x.def however TexLive Manager (as timgr) can look after this. We simply need to figure out which package provides = utf8x.def= and then install that package, which happens to be 'ucs':

  • sudo tlmgr update -self -all
  • tlmgr search --global --file utf8x.def
  • sudo tlmgr install ucs

Optional

For graphing, Aquaterm. For file downloads, wget.

Bootstrapping

- download server tarball
- untar
   
- see http://lists.gnu.org/archive/html/gnumed-devel/2013-11/msg00009.html
   re  comment-out sections which depend on su -c
   re uncomment instances of #password in config files

commenting out in

   bootstrap-latest.sh
   upgrade_db.sh

2. When the user did not establish a .pgpass file to automatically provide the password as per

   http://www.postgresql.org/docs/9.2/static/libpq-pgpass.html

however in my own downloaded tarball I uncommented all instances of

   #password

in these conf files listed in bootstrap-latest.conf:

   bootstrap-local_first.conf
   bootstrap-monolithic_core.conf

   update_db-v2_v3.conf
   update_db-v3_v4.conf
   update_db-v4_v5.conf
   update_db-v5_v6.conf
   update_db-v6_v7.conf
   update_db-v7_v8.conf
   update_db-v8_v9.conf
   update_db-v9_v10.conf
   update_db-v10_v11.conf
   update_db-v11_v12.conf
   update_db-v12_v13.conf
   update_db-v13_v14.conf
   update_db-v14_v15.conf
   update_db-v15_v16.conf
   update_db-v16_v17.conf
   update_db-v17_v18.conf
   update_db-v18_v19.conf

and I did not yet think to uncomment the occurrences in the various

   fixup_db-v10 … v18

zip modified server directory

sudo -i
(prompt for invoking user's password)

PATH=/Library/PostgreSQL/9.1/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

cp /Users/dad/Downloads/gnumed-server.19.0.zip /tmp
unzip gnumed-server.19.0.zip
sh bootstrap-latest.sh
# or sh upgrade-db.sh fromVersion toVersion
# e.g. sh upgrade-db.sh 18 19

# in case of problems, copy log out of tmp to be able to access and email it
# example:
cp /tmp/gnumed-server.19.0/server/bootstrap/bootstrap-latest.log /Users/Shared/

Adjust db settings

  • run gm-adjust_db_settings.sh

APPENDIX

Reference for the man pages for Mac OS: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/#

Locale issues:

If locale properties are not fully set, perhaps they escaped being fully set for the machine, or for that user account … the UI and user language settings can be set within the OS via

System Preferences > "Language and Text" icon
"Language" pane/tab
"Formats" pane/tab (for Locales)

Profile issues - ~/.bash_login, ~/.bash_profile or ~/.profile

Apple no longer relies on a user ~/.bash_login, ~/.bash_profile or ~/.profile in that order of hierarchy. Apple instead stores values in the user's defaults database. See:

If for some reason the above are inaccessible by GNUmed one could perhaps, as offered at http://serverfault.com/a/261807, create an /etc/.profile or user specific ~/.file containing
export LC_ALL=en_CA.UTF-8
export LANG=en_CA.UTF-8

General overview of configuration files at

Apparently [the Mac OS Terminal app skips .bashrc= and instead runs a login shell for each new terminal window calling =.bash_profile instead of .bashrc

Apparently under some modern unices, If you log in in a graphical environment (that is, if the program where you type your password is running in graphics mode), you don't automatically get a login shell that reads ~/.profile. Depending on the graphical login program, on the window manager or desktop environment you run afterwards, and on how your distribution configured these programs, your ~/.profile may or may not be read.

Python reference

Successful installation of a suitable non-Apple python can be checked with

$ echo $PATH
   /Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

Machines whose OS has been serially migrated may contain, installed, multiple pythons which can be observed from
ls -l /System/Library/Frameworks/Python.framework/Versions/

About multiple versions and their handling:

Python ez_setup and pip

The Python people in their docs (e.g. http://docs.python-guide.org/en/latest/starting/install/osx/) suggest to install not only GCC (via Xcode or Command Line Tools or OSX-GCC_Installer) but also Homebrew and PIP however such installation may complicate any efforts by GNUmed project participants to help with diagnosis.

Here, however, is how it was at one point able to be installed:

# cd /Applications <--- was probably unnecessary
python ez_setup.py
python get-pip.py

# now install 
sudo pip install psycopg2

$ pip list
egenix-mx-base (3.2.6)
pip (1.4.1)
psycopg2 (2.5.1)
setuptools (1.2)
wsgiref (0.1.2)
wxPython (2.9.5.0)
wxPython-common (2.9.5.0)
$ 
Topic revision: 20 Nov 2013, JamesBusser
 
Download.png
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback
Powered by Olark