Compiling LINUX apps for OS X w/ SCONS

Here's an easy one from a somewhat mac n00b: Compiling w/ SCONS (python based comp. tool).

I have a few linux apps that are a nessisity for my NetSec degree, and would like to re-compile them for os x. How would I do this w/ SCONS? One of the most needed is nmap:

I have no programming experience w/ very little scripting exp, and therefore don't know how to create the python script needed (the "SConstruct" file for SCONS to compile).

Could an expert please post a walkthrough on this...

In particular how does one creat the SConstruct file with multiple source files in the app's dir?
Who is Participating?
nmap-scanner is a perl module and need not to be build.

If you want to build your program out of main.c, file1.c, file2.c say

Program('program', ['main.c', 'file1.c', 'file2.c'])
There is a project called fink ( that has ported many popular linux apps and utilities to OS X. nmap is included as should most of the apps you would need -
TrilokavijayaAuthor Commented:
I appreciate the valued link. Fink has come accross my desk before, and as I'm not doubting that there's compilied packages, I would still like to learn compiling with SCONS.
Hi Trilokavijaya. Firstly, I have to say that I am very new to scons. I have learned from you that it exists -- thanks ;)

From the scons documentation ( the SConstruct is a normal text file. Just use your favourite text editor to create it and type the command inside. There is a minimal example in the doc:


This is for a C program of that name. Then you have to run the scons utility in the directory where the SConstruct file is located. It will find the SConstruct file and it will use the content.

I suggest to subscribe to the scons mailing list through the page (or directly through the

Anyway, I would try the first example from the above doc (the hello.c) just to ensure that you have installed scons correctly and that it works for you. After (un)successfull compilation of the hello.c example you will have more questions.
TrilokavijayaAuthor Commented:

np on the heads up on such a sweat compiling prog.

My question still abides in the  the "vi'ing a fresh SConcstruct" method...I can't simply call to a single file...there's tons of .sh files in the dir, i have to dig a touch deeper...

If you somehow can get a consistent way to compile more complex progs than the hello world exam[ple, please post it.

Why not try out nmap? it's a small prog, and would be a great excersice to help out.

BTW, this is a SCONS thread, not nmap...yes, fink carries the package...however fink doesn't compile scons, and fink doesn't offer much selection only 1700 of the mill unix, ie. "fetchmail"...and is far behind on the security sector, with unfulfilled packages for apps like "wireshark," etc...

MacAnthony, as skillful as your answer is as a workaround for installing nmap, people need to become more aware as to the awesome compiling prowess of SCONS, and add their advices pertaining to such.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.