MacPorts

Note: In November 2013, it was determined that wxWindows 2.9 is close to enabling a non-MacPorts, Mac-native GNUmed. This is being tested on MacNativeGNUmed.

MacPorts is used by at least one GNUmed user to download and manage software dependencies under Mac OS. MacPorts thereby enables
  • the bootstrapping and updating, on the Mac, of a GNUmed database and
  • to run development code and POSIX releases independently of pre-packaged (all-in-one) binary Mac installers.

Installing the GNUmed dependency psycopg2 will also install a version of the postgres database server.

If you already know all about Apple's Xcode Tools and MacPorts, you can skip down to Installing.

Caveat emptor

Apple's Macintosh computers have been making a transition between
  • PowerPC and x86 Intel chips
  • 32-bit and 64-bit capable processors
  • 32-bit (Tiger, Leopard) and 64-bit (Snow Leopard) operating systems.

and so in the case of a particular machine, its processor (32 or 64-bit capable) combined with the version of Mac OS X determines whether and how GNUmed can run under one of Apple's own APIs or (only) the more generic X11 windowing system. When last attempted in 2010, wxWidgets could only run on Mac OS under
  • X11
  • Carbon/Quartz (up to Mac OS 10.5 Leopard)
  • but not Cocoa

A 64-bit capable processor, running Snow Leopard, defaults to 64-bit. Any softwares desiring to use Carbon can only be built 32-bit (i.e. cannot be universal). While it is easy enough to uninstall all ports and set macports.conf build_arch to i386 to more reliably build multiple ports as 32-bit, and while this would still allow to build universal variants for ports that do not use Carbon (provided, as usual, that any port installed "universal" has all its dependencies built universal as well), python26 unfortunately does not enforce build_arch. Until this is addressed, and/or wxWidgets would in future compile 64-bit with Cocoa support, it seems that on Snow Leopard the options to run GNUmed are to run it under X11, or to run GNUmed pre-packaged as an all-in-one binary.

More concerning wxWidgets in these tickets at MacPorts: ticket 20952, ticket 24350. Also at the wx site.

What are MacPorts and Pallet?

The MacPorts project is an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac OS X operating system. The result: ready to build, open-source software packages modified to compile and run on Mac OS X. The MacPorts project provides a TCL command line tool to manage installation, update and activation of the port packages. Formerly "Darwin Ports", MacPorts is contrasted with an alternative project ("Fink") here. Open source tools like wget can could alternatively be installed using homebrew.

Pallet provides a friendly, GUI front-end to MacPorts' TCL command line tool.

What are Apple's Xcode Tools?

These are Apple's free proprietary tools which allow various special or advanced features to be performed on the Macintosh. Ordinary Mac users seldom need these Xcode Tools whereas people who would develop or use special software on their Mac will need to do this extra installation.

While Apple's Xcode Tools do not need to be in place for every aspect of MacPorts, Xcode's tools are depended on at any point where MacPorts would, upon selfupdating need to compile a new base version of itself, or would install any of numerous ports, including a non-Mac OS version of python. Lack of an installed Xcode Tools commonly underlies the MacPorts error message
error: no acceptable C compiler found in $PATH.

The version of Apple's Xcode Tools required by MacPorts is given here. Most likely, Xcode Tools won't have been installed until someone took deliberate steps to do so. Check for them by
  • in Terminal, typing open -a Xcode. If it tells you "Unable to find application named 'Xcode'" then they're probably not installed.
  • alternatively, in the Finder, open your startup disk hard drive, and identify the presence of a folder Developer, within which there should be a sub-folder Applications (distinct from main /Applications). Within this, you should find Xcode, if it's installed.

To identify an installed Xcode's version, you can launch it, and look in Xcode > About Xcode. Before installing newer versions, you may like to use Apple's uninstaller to remove the existing tools, like so: sudo /Developer/Library/uninstall-devtools --mode=all

Installing Apple's Xcode Tools

Obtain Xcode Tools (~ 800 Mb) from one of:
  • a recent Apple-supplied Mac OS X Install DVD –
    • open the folder "Optional Installs", subfolder Xcode Tools
    • the file "About Xcode Tools.pdf" should give the version number
    • within this same subfolder
      • it is only the package XcodeTools.mpkg which needs installing
      • the WebObjects.mpkg is needed only for webobjects related projects and Dashcode.mpkg for those who would make Dashboard applications.
  • Apple's web site
    • check the version requirement from MacPorts install page and follow the link to the Developer Connection Member Site
    • if you lack a free Apple developer account, it requires only a basic registration
    • navigate to Downloads > Developer Tools
    • scan the listings for a suitable "Xcode v.v.v Developer Tools" (Leopard 3.1.4, Snow Leopard ≥ 3.2.2)

Advanced: it is possible to install multiple versions of Xcode into separate directories.

Installing MacPorts

Go to the MacPorts site, either to their installer instructions page or directly to their distfiles directory listing. Unless you have a reason to do otherwise, download the disk image (.dmg) file that is most suitable for your current Mac OS. It may (or may not) still be MacPorts-1.9.1-10.5-Leopard.dmg or MacPorts-1.9.1-10.6-SnowLeopard.dmg.

The package will download automatically, and you will later be prompted to accept the installation with your user account password.

Budget adequate time

Depending on your network's bandwidth and reliability, and on your computer's processing power and state of heaviness of usage, quite a bit of time (many minutes, but less than an hour) may be required for a complete, first-time install, including compile time. If you desire to devote only one of two cores to this activity in order to better use your Mac for concurrent tasks, refer to the bottom of this section.

Problems?

If after installing MacPorts you encounter a log message "port: command not found", you may have installed MacPorts from source and suitable lines may have failed to be added to the user's home directory file .bash_profile, as should have been achieved by a postflight script. Additional notes of possible help, compiled from the MacPorts guide and the users' list, are here.

Setup GNUmed's dependencies

option 1: setup for Mac-native display (unavailable for Snow Leopard through Mountain Lion)

# Xcode 3.1.4 for Leopard
# obtain from http://connect.apple.com/
# along screen right, under "Downloads", click "Developer Tools"
# select the latest appropriate Xcode Tools *for your Mac OS* listed from among other offerings
# MacPorts 1.9.1 installed per wiki page above
# then do as follows; for debug mode, substitute "port -d"

sudo port install py26-psycopg2 +postgresql84

# from the tip at http://trac.macports.org/ticket/24312

sudo port install cairo +no_x11 +quartz gtk2 +no_x11 +quartz
sudo port install py26-mx-base
sudo port install wxWidgets-python +carbon
sudo port install py26-wxpython +carbon
sudo port install texlive +doc +letter
# without the following, result is ! LaTeX Error: File `utf8x.def' not found:
# note: on installing with Porticus, Growl communicated "failed", yet works 
sudo port install texlive-latex-extra
# for plotting:
sudo port install gnuplot
sudo port install py26-gnuplot


sudo port -d install python_select
# to query the installed pythons:
#     sudo port select python
# to set the python version:
sudo port select python python26

option 2: setup for X11 display (Leopard through Mountain Lion)

# because on Mac psycopg needs something from postgres84 server; ~ 10 minutes:
sudo port install py26-psycopg2 +postgresql84
# To make python 2.6 the default (i.e. the version you get when you run 'python'):
sudo port select --set python python26
# mesa is needed as a depends_lib for the gtk2 variant; ~ 5 minutes:
# note: the following by default will as at OCt 2011 by default use python 27 and maybe needed +python26 variant
sudo port install mesa
# 
sudo port install wxWidgets-python
sudo port install py26-wxpython
sudo port install py26-mx-base
# for printing e.g. to PDF
sudo port install texlive # about 20 minutes
sudo port install texlive-latex-extra # about 20 minutes
# needs /opt/local/etc/macports/macports.conf configured to build_arch         i386
sudo port install gnuplot # about 10 minutes
# needs /opt/local/etc/macports/macports.conf reverted to default
sudo port install py26-gnuplot # about 5 minutes

option 3: undo option {1,2}

sudo port -f uninstall installed
sudo port clean --work --archive all
sudo port selfupdate
sudo port upgrade outdated

Download GNUmed

Command line method
# Mac OS provides curl, but not wget
cd ~
curl http://www.gitorious.org/gnumed/gnumed/archive-tarball/master -O
mv master master.tar.gz
tar -xvf master.tar.gz
# change to client directory and run from vcs
cd ~/gnumed-gnumed/gnumed/gnumed/client
./gm-from-vcs.sh
# the log gm-from-vcs.log will be found the same directory as the above script

Go to http://www.gitorious.org/gnumed

You will typically need to
  • cd ~/Downloads/gnumed-gnumed/gnumed/gnumed/client
  • need to uncomment the workplace #Clinician in gm-from-vcs.conf
  • run ./gm-from-vcs.sh
  • copy some external tools into the path
    • e.g. sudo cp /Users/djb/Downloads/gnumed-gnumed\ 3/gnumed/gnumed/external-tools/gm-print_doc /opt/local/bin
  • ensure your PATH is adequate using echo $PATH
    • maybe needs to be
      • =export PATH=/opt/subversion/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin
=

Installing the PostgreSQL server

See MacPortsPostgres but be aware that for bootstrapping Mac OS one seems to need an extra password-passing for postgres, accordingly some of the bootstrapper update files, need to uncomment #password for postgres

Notes

In aiming for Mac-native GUI, wxWidgets presently supports only Carbon not Cocoa, and Carbon supports only 32-bit architectures.

py26-wxpython
  • has variants carbon, gtk, universal
  • but also depends on python26 and wxWidgets-python
  • and wxWidgets-python while having variants carbon debug gtk nonmonolithic, itself depends on
    • expat gtk2 jpeg libiconv libpng tiff zlib
    • where gtk2 has variants no_x11 quartz universal x11

and so when downstream dependencies had needed variants which would neither be installed by default, nor effectively called-for by the depending software, the downstream dependencies may need to be specifically called and installed before the upstream ones e.g.
  • gtk2 with variants +no_x11 +quartz
  • wxWidgets-python +carbon

# but for 10.6 to install carbon (i386) would require to alter wxWidgets-python Portfile as per the uncommitted diff # see https://svn.macports.org/attachment/ticket/24350/wxWidgets-python_Portfile.diff # Leopard can run this without modification of the base Portfile

sudo port -d install wxWidgets-python +carbon

# but per ticket http://trac.macports.org/ticket/24383 # the following will break on 10.6, as python26 does not enforce build_arch

sudo port -d install py26-wxpython +carbon sudo port -d install py26-mx-base sudo port -d install texlive +doc +letter

setup for GNUmed using the optional Porticus

Note: these instructions are obsoleted and require updating. Porticus is undeveloped past MacPorts 1.9 and Snow Leopard 10.6. Possibly a variation of the following will work with Pallet but this remains speculative.

Applicable to Mac OS 10.5.x Leopard. Needs fixing if running Snow Leopard. Need to check if python-select is installed as a dependency and also the resulting default version of python.

Download v 1.8.1 of Porticus (GUI to MacPorts) drop it into your main /Applications folder. On opening it, let its Preference "At startup" to "Update everything" (do a MacPorts selfupdate).

  1. Select "All Ports" from the Porticus directory, within which to search (and install), in order:
    • py26-psycopg2 (Version 2.0.13_0 used) (--> 2.2.1.0)
      • select variants postgresql84 also universal (else without universal get an error)
      • result: 44 ports installed (these include python26) * py26-mx-base (Version 3.1.3.0 used)
      • select universal (needed?)
      • result: 45 ports installed
    • py26-wxpython (2.8.10.1_0)
      • ?universal (but not ? carbon ?gtk no selection to make)
      • result: 64 ports installed, including wxWidgets
      • command line equivalent sudo port -d install py26-wxpython
    • texlive-base
      • no selection to make
      • result: XX ports installed, including YY
    • future: gnumed-client (PortFile under development)
    • Note: with each selection, Porticus will open and present a combination pending Command display and Variants selection window. Porticus suffers a small bug in which – even in the absence of Variants – the progress spinner can spin endlessly. After a few seconds, you can ignore this, and click 'Install".

It is not yet possible to fully avoid using Apple's Terminal application within your /Applications/Utilities folder. Provided you are logged into your Mac in an account of type "Admin", launch Terminal, and do (copy, paste)
sudo ln -s /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 python

In response to having issued the sudo command, the prompt "Password:" will be for the account from which you are logged-in, not any root password.

# if needing to uninstall everything and clean any partially-completed builds and remove any archives:
sudo port -f uninstall installed
sudo port clean --work --archive all
# then:
sudo port selfupdate
sudo port upgrade outdated
sudo port -d install py26-psycopg2 +postgresql84
# on account of a bug (see MacPorts list)
# but maybe needed only if using default x11 v of wxWidgets:
sudo port -d install mesa
# don't yet know whether carbon is correct:
# won't work so skip
# sudo port -d install gtk2 +no_x11 +quartz
# must pre-install wxWidgets-python with +carbon (nondefault)
#   else py26-wxpython +carbon will be unable to build
# but failed on the next line
sudo port -d install wxWidgets-python
sudo port -d install py26-wxpython
sudo port -d install py26-mx-base
# for printing medication lists
# not sure yet whether the variants +doc +letter will be needed:
sudo port install texlive
# To fully complete your installation and make python 2.6 the default, please run:
sudo port install python_select
sudo python_select python26
# not needed, if using python_select, to map python to python26:
sudo ln -s /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 python

Note there is some dependency on mesa missing from wxWidgets which will prevent completion of the py26-wxpython. Accordingly if that happens one should do
: sudo port clean --all wxWidgets-python and then
sudo port -d install py26-wxpython

On account of GNUmed calling 'python' (and not python2.6), do
sudo ln -s /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 python

Download GNUmed

  1. Download, to your User's Downloads folder, the GNUmed client from tarball, and double-click on it to unarchive it.
  2. from a Terminal command line, do e.g.
    • cd ~/Downloads/GNUmed-whatever/client
    • ./gm-from-vcs.sh
  3. after you login (userid = pw = any-doc), hide the (debug ) STDOUT/STDERR log window, and fix the window size using the GNUmed Window > Zoom menu item
  4. Enjoy! Next, modify your gm-from-vcs.conf as desired, create GUI aliases, and more.

Results of port installation

After installing py26-psycopg2

MacBook:~ djb$ port contents py26-psycopg2
Port py26-psycopg2 contains:
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/__init__.py
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/__init__.pyc
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/_psycopg.so
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/errorcodes.py
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/errorcodes.pyc
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/extensions.py
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/extensions.pyc
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/extras.py
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/extras.pyc
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/pool.py
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/pool.pyc
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/psycopg1.py
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/psycopg1.pyc
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/tz.py
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/tz.pyc
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2-2.0.13-py2.6.egg-info
MacBook:~ djb$

MacBook:~ djb$ port installed
The following ports are currently installed:
  bison @2.4.1_0 (active)
  bzip2 @1.0.5_3+darwin (active)
  db46 @4.6.21_6 (active)
  expat @2.0.1_0 (active)
  fontconfig @2.8.0_0+macosx (active)
  freetype @2.3.11_1+macosx (active)
  gdbm @1.8.3_2 (active)
  gettext @0.17_4 (active)
  gperf @3.0.4_0 (active)
  groff @1.20.1_1 (active)
  libiconv @1.13_0 (active)
  libxml2 @2.7.6_0 (active)
  libxslt @1.1.26_0 (active)
  m4 @1.4.13_0 (active)
  ncurses @5.7_0+darwin_10 (active)
  ncursesw @5.7_0+darwin_10 (active)
  openssl @0.9.8l_0+darwin (active)
  ossp-uuid @1.6.2_0 (active)
  pkgconfig @0.23_1 (active)
  postgresql84 @8.4.2_0 (active)
  py26-psycopg2 @2.0.13_0+postgresql84 (active)
  python26 @2.6.4_0+darwin (active)
  readline @6.1.000_1+darwin (active)
  sqlite3 @3.6.22_0 (active)
  tcl @8.5.8_0+darwin (active)
  tk @8.5.8_0+darwin (active)
  Xft2 @2.1.14_0 (active)
  xorg-bigreqsproto @1.1.0_0 (active)
  xorg-inputproto @2.0_0 (active)
  xorg-kbproto @1.0.4_0 (active)
  xorg-libX11 @1.3.2_0 (active)
  xorg-libXau @1.0.5_0 (active)
  xorg-libXdmcp @1.0.3_0 (active)
  xorg-libXext @1.1.1_0 (active)
  xorg-libXScrnSaver @1.2.0_0 (active)
  xorg-renderproto @0.11_0 (active)
  xorg-scrnsaverproto @1.2.0_0 (active)
  xorg-util-macros @1.4.1_0 (active)
  xorg-xcmiscproto @1.2.0_0 (active)
  xorg-xextproto @7.1.1_0 (active)
  xorg-xf86bigfontproto @1.2.0_0 (active)
  xorg-xproto @7.0.16_0 (active)
  xorg-xtrans @1.2.5_0 (active)
  xrender @0.9.5_0 (active)
  zlib @1.2.3_4 (active)
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