installing C compiler on Mac
I do not have a Macintosh but I am developing a Bioinformatics
computer program which also runs on Mac. My computer program is mixed
Java, C/C++ and Fortran because many free tools are embedded.
The program parts that are not in Java are compiled on the client
computer. The compilation process is launched automatically by the
main application which is in Java1.4.
C/C++ and Fortran are installed on all modern UNIX so that no
additional installation is necessary for the user.
The user has only to specify the compiler commands and options.
By default f77, gcc or g++ is assumed.
MS-Windows supports only Q-BASIC and the application has to install
Cygwin for MS-Windows.
I was surprised, that the compilers are not installed by default on a
Macintosh and the Mac user needs to install the compilers! I thought
that Mac-OSX is a complete BSD UNIX.
At least BASH and PERL and Pymol seem to be present.
My question to the forum: I need simple installation instructions or a
Web link for the users of my program. It should not be
too technical because the program is used by people who are not
necessarily computer specialists.
What compilers would you recommend.
Is gcc optimized for the RISC processor inside Macintosh or are ther better compilers available?



Compilers on OS X
Yes, OS X does not have a compiler installed by default. They are installed as part of the Apple developer tools which are freely available from Apple (http://developer.apple.com/tools/xcode/index.html). You can also install various GNU development tools using FINK (fink.sf.net). OS X is a complete UNIX, and not having compilers installed by default doesn't change that. The majority of OS X users don't even know what a compiler is, much less require the use of one. Therefore Apple has done the smart thing by eliminating unnecessary disk contents from the default installation. The Apple developer tools are very easy to obtain and install so providing users with a link to the xcode tools download is sufficient. The compilers installed by Apple's installation package (gcc, etc) are very well optimized for both PowerPC and x86 processors.
Many thanks. I read in the
Many thanks.
I read in the Xcode Web page that it is an IDE. The user
of my application does not necessarily need an IDE, the crude
back-ends are only needed by my program. But I did not find how to
skip the IDE. Hopefully, the IDE part is not very large.
Could one convince the people who decide what comes into the default
Mac installation that a compiler is an essential tool which must be
present in any Macintosh?
You mentioned a strong argument for including the compilers: Most
Macintosh users even do not know what a compiler is and do not want to
be bothered with installation of compilers if an application needs
one. A compiler is only a couple of Megabytes and there HDs in
Macintosh is quite large.
Here is what I want to tell the user in an information box.
Is it good ?
"A Compiler takes a computer program given as source text in a certain computer language and"+
"produces an executable program for a particular computer type (here Macintosh OS-X)."+
"Therefore compilers are essential tools for computer users who use Bioinformatics UNIX software."+
"If you do not have C/C++ and Fortran compilers installed yet you could install either Xcode or fink."+
"Compilers are launched using a specific terminal commands."+
"Only if these commands differ from the standard cc, c++ and f77 "+
"you must specify the command names in STRAP. "+
"You can simply find out which compiler commands are valid using the Macintosh terminal window:"+
"Typing cc for \"compile C-program\" or c++ for \"compile C++ program\" or f77 for \"compile Fortran program\""+
"into the terminal shell must yield a message like gcc: no input files."+
"The GNU versions may have the commands gcc and g++ instead of cc and c++ instead.",
)ChSwing.pan(Web.b("http://fink.sourceforge.net/"), Web.b("http://developer.apple.com/tools/xcode/"))
Note though that the
Note though that the developers tools are required to use fink.
Also the developers tools include c and c++ compilers but no fortran. Fink can install g77 (for a f77 compiler) and both g95 and gfortran (fortran 95 compilers).
xcode + g77 or gfortran
The users of your code should first install Apple developer tools which are freely available from Apple, this includes the GCC compilers. Most freely available source code requires Mac users to install the developer tools and this is straight forward. I think there is a way not to install xCode but I don't think you should worry about this.
Fortran compilers are not supplied by the Apple developer tools. People can install Fortran complier from the Fink project or MacPorts but I think the safest way is to install the compilers available at http://hpc.sourceforge.net. There is also an installer available from Macresearch which packages this distribution plus some plugins for xCode.
I need help on c language for mac.
I need help on c language for mac.
Is there c compiler for mac?
compilers
I was surprised, that the compilers are not installed by default on a
Macintosh and the Mac user needs to install the compilers! I thought
that Mac-OSX is a complete BSD UNIX.
Yes, OSX is a fairly complete BSD "with a candy coating". But what do compilers have to do with the UNIX specification? Installing a compiler won't turn Windows into UNIX either ;)
I guess the answer is that OSX is far less a niche product than Linux is, and the vast majority of users will never need a compiler in their life. So why would you force graphics artists, moviemakers, musicians and my grandmother (who owns an iMac to chat with her grandchildren) to install a compiler they will never need?
processor
What compilers would you recommend.
Is gcc optimized for the RISC processor inside Macintosh or are ther better compilers available?
Present-day Macs have Intel CPUs, the older (pre ~2006) machines had PPC (PowerPC) processors. Both architectures are extremely well supported by gcc, and optimization is fairly good in my opinion. On the Intel machines you might also try Intel's C++ and Fortran compilers.
But please take the advice from someone who does scientific software development for a living: If you want "User Joe" to install and use the program, there is no way around a user-friendly binary installer. No matter what the platform is - a user who does not already know what a compiler is and how to install one on his platform most likely also won't go through the effort of compiling it (even if it's only configure && make install). And those who try will give up at the first error message due to some unsatisfied dependency.
Forgive me, sometimes I fall into "lecturing mode". It's an occupational disease ;)
Since Apple provides GCC for
Since Apple provides GCC for free, I rarely see any discussions about alternatives except for other languages. Even alternative IDEs are often ignored since you get Xcode installed with the compilers. But there are several other IDEs.
Considering your need to get a simple install of GCC and related tools, I think it should be possible since they are all free tools. So it should be possible to install a small subset of the developer tools with your program, using the standard installer. I have some need for such an installer myself, but I am not totally sure how to proceed, if I can just grab and redistribute GNU stuff from Apple's installers or if I must get them from somewhere else to be 100% legal.
I have done some more work
I have done some more work on this, and found a subset of the Xcode installers that install GCC and necessary libs but not all the unneeded material. However, I have not yet figured out exactly what material are freely distributable or not. I would like to produce a nice mini-installer, it would be useful not least for educational purposes.