[mod_python] Using mod_python with MacOSX Tiger/Leopard.

Jorey Bump list at joreybump.com
Mon Mar 10 22:55:09 EDT 2008

I have a MacBook Pro I use only for compatibility testing and light 
wireless use around the house. Here are the current specs:

   OS: OS X Version 10.5.2 (Leopard)
   Processor: 2.4 GHz Intel Core Duo
   Memory: 4GB

I don't do any development on it, but I do have Xcode installed. I also 
installed MacPorts, but did not use it for this test. I was able to 
build mod_python successfully and run all the tests without any problem. 
Here are the commands I used:

   $ which httpd
   $ httpd -v
   Server version: Apache/2.2.6 (Unix)
   Server built:   Sep 23 2007 18:07:19
   $ which apxs
   $ which python
   $ python -V
   Python 2.5.1
   $ which gcc
   $ gcc --version
   i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)

Okay, all stock binaries in my path (although gcc may have come with 
Xcode, I don't remember).

   $ mkdir -p ~/src/mod_python
   $ cd ~/src/mod_python
   $ svn co 
   [...source checked out...]
   $ cd mod_python-trunk
   $ ./configure --with-apxs=/usr/sbin/apxs
   [...configures without error...]
   $ make
   [...compiles & builds source with a few harmless errors...]
   $ sudo make install
   [...installs mod_python.so to /usr/libexec/apache2/...]
   [...installs mod_python to /Library/Python/2.5/site-packages/...]
   $ cd test/
   $ python test.py
   [...runs all tests successfully...]

It seems to build fine on the latest version of Leopard. Someone will 
have to confirm if Xcode is needed to get Apple's gcc. Other than that, 
I used the stock system binaries (after running the latest Software Update).

Graham Dumpleton wrote, at 03/10/2008 08:44 PM:
> For those users of MacOS X out there who have been having problems, or
> moaning about  the state of Python/Apache/mod_python on MacOS X, I set
> you a challenge. Since you seem to be unwilling to come up with
> patches to fix the problems, or just aren't in a position to work out
> what the packages required might be, then please at least do the
> following.
> 1. Using a subversion client, checkout latest mod_python source code from trunk:
>   svn co http://svn.apache.org/repos/asf/quetzalcoatl/mod_python/trunk
> mod_python-trunk
> 2. Build the source code on your MacOS X system, whether that be Tiger
> or Leopard and whether you be using the standard OS installation of
> Python or an alternate version such as from MacPorts. Ensure you use
> --with-python to point at the version of Python you want to use. Use
> --with-apxs as necessary.
> 3. Install it and see if it works without you having to have made any
> changes to the source code. If you have multiple versions of Python
> installed on your system, try it with all of them to make sure all
> work. Just ensure you do a full 'stop' of Apache between testing each
> version. If you don't have code which will work with that version of
> Python, just use the mod_python testhandler.
> <Location /testhandler>
> SetHandler mod_python
> PythonHandler mod_python.testhandler
> </Location>
> 4. Respond with your results about what works and what doesn't.
> Hopefully the source in subversion trunk will now build on both Tiger
> and Leopard out of the box and deal with Python installations being in
> different locations. It also shouldn't pick up the wrong framework
> where multiple framework versions of Python are installed. On Leopard,
> it should also ensure that the mod_python.so file and the psp C
> extension module are built with the same architectures that your
> Apache binary is built with.
> Do note, I haven't myself been able to set this on Tiger yet, but
> believe it should work. Also, because this affects the main build
> process and because I replaced whole sections of configure script code
> with stuff from mod_wsgi which I know works properly, then building
> code for other platforms may also be affected. Thus, if you have
> access to other platforms besides MacOS X, then test it there as well.
> So rather than complaining, here is your chance to help out and
> improve the situation. :-)
> BTW, Apple has documented the issues with building Python C extension
> modules for additional architectures. It can be found at:
>   http://developer.apple.com/releasenotes/OpenSource/PerlExtensionsRelNotes/index.html
> This is referenced along with other stuff about the sorts of problems
> that crop up on MacOS X at:
>   http://code.google.com/p/modwsgi/wiki/InstallationOnMacOSX
> Graham
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list