[Pythonmac-SIG] Solution to some SWIG Install problems on Mac OS X

Louis Pecora pecora at anvil.nrl.navy.mil
Thu Dec 8 22:17:49 CET 2005

If you are a newbie or non-guru (like me) and are are having some 
problems installing SWIG on Mac OS X (10.3.9, but version may not matter 
for the problems below), you should be aware of some problems I had and 
their solutions.  Many thanks to several people on the email lists for 
Pythonmac-sig (pythonmac-sig at python.org) and SWIG 
(swig-user at lists.sourceforge.net) for many valuable hints, clues and 

The installation of SWIG on the Mac is the same three-step process as 
for Unix (% is the prompt):

% ./configure

% make
% make install

I had the follow problems with each step and I have the solutions.

(1) running ./configure resulted in a file not found.  When the script 
listed the file only a partial path name appeared.
   Solution:  directories (folders) and files with spaces and special 
Mac symbols (e.g. option-whatever) can cause problems.  I had some 
spaces in my folder names that held the SWIG files.  When I removed 
those and made more Unix-like names, ./configure worked (after one more 
fix below).

(2) running  'make'  caused a parse error in CParse when compiling 
    Solution:  when I looked back at ./configure I see that g++ was the 
chosen gcc compiiler or CC compiler.  I was told it should be gcc, not 
g++.  I found the line

setenv CC g++

in my login file .tschrc which I got from a colleague.  I changed it to

setenv CC gcc

ran the ./configure (with the directory changes, too) and then the 
'make' step worked.

(3) running 'make install' would not work since I had no permission to 
write in some directories. I don't fully understand this since I am the 
admin and I was running logged in as such, but to no avail.
    Solution:  run this as
sudo make install

type in the password and you're off.

So, does SWIG really work?  Not sure yet.  A test with make -k check 
gave mostly good grades to python things except for two C++ problems 
with templates and enums.  The docs say this may not matter.  We shall 
see.  At least I got this far.

Good luck to all and thanks to many for the help.


Lou Pecora

Code 6362
Naval Research Lab
Washington, DC  20375
Ph:  +202-767-6002
email:  pecora at anvil.nrl.navy.mil

More information about the Pythonmac-SIG mailing list