You are here: Foswiki>Gnumed Web>MacPortsRu (16 Feb 2013, IvanLykov)EditAttach


MacPorts используется, по-крайней мере, одним пользователем GNUmed для загрузки и управления зависимостями программы под Mac OS. MacPorts позволяет
  • начальнаую загрузку и обновление на Mac для базы данных GNUmed и
  • запуск кода разработчика и версий POSIX, независимо от препакетированных (all-in-one) бинарных установщиков Mac.

Установка GNUmed в зависимости от psycopg2 будет также устанавливать версию сервера базы данных postgres.

Если вы уже знакомы с инструментами Xcode от Apple и MacPorts, то можете перейти к установке.

Предупреждение emptor

Компьютеры Macintosh от Apple имеют переход между
  • PowerPC и x86 Intel чипсетами
  • 32-bit и 64-bit совместимыми процессорами
  • 32-bit (Tiger, Leopard) и 64-bit (Snow Leopard) операционными системами.

и поэтому на отдельном компьютере его процессор (32 или 64-bit совместимый) совмещен с версией Mac OS X, которая ограничивает, где и как GNUmed можно запустить под одним из API владельца Apple или (только) более общей оконной системой X11. Как принято в 2010, wxWidgets может быть запущен только под Mac OS
  • X11
  • Carbon/Quartz (до Mac OS 10.5 Leopard)
  • но не Cocoa

64-bit процессор, запускает Snow Leopard по умолчанию на 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.

Что такое MacPorts и 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.

Что такое инструменты Xcode от Apple?

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

Установка инструментов Xcode от Apple

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.

Установка 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.


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.

Настройка зависимостей GNUmed

вариант 1: настройка для экрана Mac-native (недоступная для Snow Leopard)

# Xcode 3.1.4 for Leopard
# obtain from
# 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

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

вариант 2: настройка для экрана X11 (Leopard, Snow Leopard)

# 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

вариант 3: параметр undo {1,2}

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

Загрузка GNUmed

Метод командной строки
# Mac OS provides curl, but not wget
cd ~
curl -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
# the log gm-from-vcs.log will be found the same directory as the above script

Перейдите на

You will typically need to
  • cd ~/Downloads/gnumed-gnumed/gnumed/gnumed/client
  • need to uncomment the workplace #Clinician in gm-from-vcs.conf
  • run ./
  • 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

Установка сервера PostgreSQL

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


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

  • 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 # Leopard can run this without modification of the base Portfile

sudo port -d install wxWidgets-python +carbon

# but per ticket # 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

настройка для использования GNUmed необязательного 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.

Скачайте v 1.8.1 из 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) (-->
      • select variants postgresql84 also universal (else without universal get an error)
      • result: 44 ports installed (these include python26) * py26-mx-base (Version used)
      • select universal (needed?)
      • result: 45 ports installed
    • py26-wxpython (
      • ?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

В учетной записи GNUmed, называемой 'python' (но не python2.6), сделайте
sudo ln -s /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 python

Загрузка GNUmed

  1. Скачайте в свою папку Загрузки клиента GNUmed из tarball, и дважды кликните по нему для разархивирования.
  2. from a Terminal command line, do e.g.
    • cd ~/Downloads/GNUmed-whatever/client
    • ./
  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.

Результаты установки порта

После установки py26-psycopg2

MacBook:~ djb$ port contents py26-psycopg2
Port py26-psycopg2 contains:
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: 16 Feb 2013, IvanLykov
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