Take the 2-minute tour ×

I am trying to create a .pkg installer for a python application (specifically Spyderlib). This is not an app but a python package and a command line executable that have to be copied to specific locations.

However, the location depends on the version of OSX. I'm only targeting 10.6 and 10.7 but they come with different versions of python (2.6 and 2.7) so the install path is different.

Using bdist_mpkg I was able to create a Mac mpkg in 10.7 which installs correctly and can be edited with PackageMaker. Now I want to know how I can edit this package so that it detects the version of OSX and sets the install target path correctly.

I understand that I can use shell scripts to do pre and post-installation jobs, however I haven't been able to find examples of how to do this and how a script could but used to set the install target for the files in the mpkg.

Alternatively, it may be that this is possible to do directly from PackageMaker, but i was not able to see anything to this effect (and the documentation seems quite superficial).

So I would like to know how this could be done. It would also be really helpful to see some examples for other software packages.

share|improve this question
I am wondering if PackageMaker allows invoke custom installation script? If it is 'yes', you can use something like setuptools or distribute. They handle detection and installation issues really well. All you need to do is to ask PackageMaker make use of them, though~ –  Drake Feb 20 '12 at 4:11
add comment

1 Answer

You don't need any scripts - you can do that with Package Manager alone - the Package Manager GUI allows you to tag packages as installable (enabled) and selected based on conditions such as OS version (in Choices under Requirements)

share|improve this answer
add comment

Your Answer


