User Tools

Site Tools




Libraries Required happy to help test Mac versions of modules e.g.


Installable but not yet working properly:

  • Pdftk - Malformed → Standard PDF. Even pdftk –version fails with an error about library not loaded. has made a new release but still a problem on Leopard.

Not installable:


  • libtool libtool wkhtmltopdf -o wkhtmltopdf.dylib
  • Homebrew [Not needed to get wkhtmltopdf if in the fortunate position of being able to use a pre-prepared binary] Bet then extract and copy to /usr/local/bin (cp -R src dest). cd into directory with brew then brew install boost
    Used brew to install boost (needed by PythonMagick) and wkhtmltopdf (the dmg at wkhtmltopdf downloads failed with a message about 'You can't open this application “wkhtmltopdf” because it is not supported on this architecture'.

Deb Packaging Notes

Old Approach

  • debug = False etc as usual
  • Run /home/g/projects/SOFA/0 KEEP pre_OSX_packaging
  • Open macpackager in VirtualBox
  • Delete existing macmaker folder on Desktop
  • From ubuntu > grantshare copy fresh macmaker onto Desktop


  • Open Platypus with profile of SOFA Statistics.platypus
    • check version number e.g. 1.0.6
    • Save bundle to Profiles folder (/Users/g/Library/Application support/Platypus/Profiles).
    • Click Create to make fresh app bundle (containing freshest Create to /Applications (mactest/Applications).
    • Extra details
      • Script path should be from macmaker i.e. /Users/g/Desktop/macmaker/sofa.main/
      • Leave “Remains running after initial execution” unticked.
      • Script Type - Other
        • /Library/Frameworks/
        • Parameters - /Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 yourScript
    • Close Platypus


  • Open sofa_app project in Iceberg
    • Check version and short version
  • Build to make sure contains latest app bundle and thus latest
  • Open sofa_pkg project in Iceberg
    • NB if new files, add them to this
  • Build to make sure package contains latest SOFA scripts from macmaker
  • Open sofastatistics project in Iceberg
    • Update version and short version
    • Run build and run process
  • Close Iceberg

Quick Local Test

Open SOFA Statistics from Go>Applications>SOFA Statistics

Make DMG


  echo "Enter version number e.g. 1.0.7:"
  read version
  dmg2make="/Users/g/Desktop/sofastats-${version}_for_mac.dmg" # (no spaces around =)
  rm -f "$dmg2make"
  rm -rf "/Users/g/Desktop/sofastatistics/sofastatistics.mpkg"
  cp -R "/Users/g/sofa_mpkg/build/sofastatistics.mpkg" "/Users/g/Desktop/sofastatistics/"
  # ov - overwrite if already there
  hdiutil -verbose create "$dmg2make" -srcfolder "/Users/g/Desktop/sofastatistics" -ov -megabytes 85 -volname "SOFA Statistics"
  echo "FINISHED" 

Manual Steps

  • Copy g/sofa_mpkg/build/sofastatistics.mpkg to desktop
  • Empty sofastatistics folder of old sofastatistics.mpkg and put in new one
  • Right click (or CTRL-Click) the folder and select “Get Info” and note the size of its contents.
  • Open Disk Utility (Applications > Utilities > Disk Utility)
  • Click the “New Image” icon to create a new disk image.
    • Name the image sofastats-1.0.1_for_mac.dmg (or whatever version)
    • Set Volume Name to SOFA Statistics
    • Select a size adequate for the size of your folder you created in Step 2. If 71MB may need 85MB. Set the encryption to “none” and Format to “read/write disk image.”.
  • Copy the sofastatistics folder into the newly mounted disk image.
  • Unmount the Disk Image by right clicking and selecting to eject it.
  • On macpackager, overwrite DMG in grantshare
  • Close macpackager

Iceberg Meta Packaging

Iceberg Packager for OS X

Handles pkgs and file transfers.

Use same licence file as for Deb

Transfer main sofa scripts under /Library/sofa

Remember subfolders

  • boomslang
  • dbe_plugins (forget 2 MS ones)
  • images

Also the following subfolders ready for copying for local user:

  • css
  • reports
  • _internal
  • vdts
  • projs

Install following packages:

  • python-2.6.5-macosx10.3-2010-03-24.dmg
  • wxPython2.8-osx-unicode-
  • matplotlib-

Install into /Applications (i.e. make an icon)

NB to enable users to opt out of certain parts of the instalation - e.g. skip Python 2.6.5 because they already have 2.6.3 - must have at least one package which is Unselected. If all packages are selected, the user is assumed to want all of them and gets no choice to have a custom install!

Platypus App Bundling

  • Use explicit path to Python 2.6 - /Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
  • The starter script (/Library/sofa/ needs to add /Library/sofa to sys.path otherwise it won't find its fellow modules e.g.
  • Select None for Output
  • Untick leaving application running at end (otherwise Python closes but a useless SOFA icon stays running in the Dock).

Making Icon Bundle

  • Make series of TIFFs with no compression and transparency ticked
  • 16x, 32x, 128x, 256x
  • Under macpackager > Developer > … Icon Maker, create icon set, save config, and Export as icns file.
  • The icns file will be used in platypus (right click on image to get menu item for selecting an icns file).

Virtualising Mac OS X

Need VirtualBox 3.2 beta 2

Need iDeneb 1.6 10.5.8 Lite Edition

Do not use efi, or it will not boot into the newly installed virtual HDD

Leave iDeneb connected as the CD so it uses that to boot. Necessary, even though booting onto virtual HDD.

Need at least 15GB space. 30GB seems a safe bet with room for databases etc.

Required packages









PyMySQL is much easier to install in OS X than MySQLdb.

In my virtualised test installation the user is “mysql” and there is a blank password.

From the terminal it is possible to test if mysql is running:


NB may want to install MySQL startup as well as MySQL itself.


Presumably you have already installed MySQL and, optionally, the MySQL utility which makes MySQL run automatically on startup.

PyMySQL is the simple library you need to install that lets SOFA Statistics connect to MySQL:

Open the downloaded file onto your Desktop

Open terminal (under Applications>Utilities)

cd Desktop/PyMySQL-0.4

python2.6 install

(NB python2.6 so the package is installed to the version of Python that SOFA Statistics us)

Open SOFA and configure your connection to MySQL as per


NB to test if MySQL is running you can run the following command in the terminal:

/usr/local/mysql/bin/mysql Home



NB I have already installed Python 2.6 from the package python-2.6.5-macosx10.3-2010-03-24.dmg. The 10.3 means it will work with everything 10.3 and above. My version of Leopard is 10.5.8.

Download setuptools-0.6c11-py2.6.egg from here: Then, in the terminal:

  • cd Desktop
  • sh setuptools-0.6c9-py2.4.egg

If you don't have gcc and you are running Leopard, install xcode313_2736_developerdvd.dmg. If you are running Snow Leopard, there is a newer version of Xcode to use, but that is easy to find. This step may require registration with Apple. See

Must have a version of MySQL installed. I used mysql-5.1.47-osx10.5-x86.dmg. If not installed, then step for MySQLdb will not succeed.

Download MySQL-python-1.2.3c1.tar.gz from here:

Extract on desktop. Do this by opening with … Archive utility.

Then open the folder it created on your desktop - MySQL-python-1.2.3c1. Edit using IDLE (1) so mysql_config.path = “/usr/local/mysql/bin/mysql_config” not just “mysql_config”. There is another way to do this involving PATH and env etc but this is pretty simple. 1) Set preferences of IDLE to 14px otherwise it is unbearably ugly and spoils the OS X experience ;-)

In the terminal:

  • cd Desktop/MySQL-python-1.2.3c1
  • python clean (not much point - if first time, nothing to clean; if have to redo, need to completely remove the build folder anyway e.g. from the extracted MySQL folder: rm -rf build)
  • ARCHFLAGS='-arch i386' python build


NB if you mess it up, use rm -rf build to get a proper clean start. The clean approach is not enough.

sudo python install

Test by opening IDLE, and typing in import MySQLdb. NB case matters - import mysqldb won't work, nor should it.



If not installed, then step for postgreSQL will not succeed.

Pre-installation Memory Config

  • sudo pico /etc/sysctl.conf

add/edit 5 lines to set memory correctly e.g.



shmall is measured in pages. Multiply by 4096 and check that is no less than what is allocated to max.

Actual installation

NB may take several minutes before installer will properly display dialog. Wait at least 10 mins.

Install latest tar.gz from e.g.

May have to hardwire location of pg_config in broadly similar fashion to old instructions below. See if any errors which give a clue.

Old instructions (which should work given pgdb is supported as a fallback if psycopg can't import):

In PyGreSQL-4.0.tgz (you can get a copy from - see

f = os.popen(“pg_config –%s” % s) should be … “/Library/PostgreSQL/8.4/bin/pg_config …”

Eclipse and PyDev


extract and then copy under /Library folder

pydev - (need to add in Help>Install New Software)

project interpreter - /Library/Frameworks/Python.framework/Versions/2.6/bin/Python

SOFA Scripts etc

When transferring sofa, and sofa.main, set permissions by cd into folder containing both and

  • sudo chmod -R 777 sofa
  • sudo chmod -R 777 sofa.main

Put sofa.main on Desktop.

Put sofa in home folder (not on desktop).

Delete proj_file_customised.txt


Packages Backup

Ensure mime.conf for dokuwiki has the following line:

packproj text/xml

Find the following package files in /Users/g/ under sofa_app, sofa_mpkg, and sofa_pkg. Add proj extension.





proj/macdevold.txt · Last modified: 2014/12/28 13:44 by admin