How does Macport work?
ohce86 at kitcarson.net
Wed Jun 10 17:08:37 PDT 2009
Fon's question got me thinking. While /opt/local/bin precedes /usr/
bin in my $PATH, when I `which gcc` I get /usr/bin/gcc. Huh? Since
I've never had insurmountable compiler glitches, I'd lost track of how
I'd worked around previous issues. I have created a mess! In /usr/
bin/ I've got two executables, gcc-4.0 and gcc-4.2 (renamed mp files,
if I recall correctly) and two links:
gcc -> /usr/bin/gcc-4.0 and
gcc-4.3 -> /opt/local/bin/gcc-mp-4.3
In /opt/local/bin, I've got gcc-mp-4.3 and gcc-mp-4.4 (and the gccbug
I would like to be able to type gcc and fire up the latest C compiler
(gcc-mp-4.4?), which is not as problem; however, I don't want to try
to compile older code that might (?) not be compatible with gcc-mp 4.4.
What is the "clean", correct way to manage my C compiler(s)?
On Jun 10, 2009, at 5:14 PM, Michael Crawford wrote:
> On Wed, Jun 10, 2009 at 4:06 PM, Fon Vitale<fonvitale at gmail.com>
>> Coming back whit the C compiler example, if Macports installs the
>> when I run it what compiler is being running: Macports installed or
>> Macports one?
> That depends on the value of your PATH environment variable. Give the
> following command in the Terminal:
> echo $PATH
> You'll see a list of directories. If /opt/local comes before
> /usr/bin, then the MacPorts version will be run; otherwise the
> previously installed one will be run.
> You can also do:
> which gcc
> ... and it will give you the pathname of the gcc that will actually be
> run if you simply give the "gcc" command. Which does its work by
> examining each of the directories in your PATH.
> If you're not hip to PATH and other environment variables, try the
> following Google search:
> UNIX shell tutorial
> There's lots of good ones, and if you're going to be working with the
> command line on Mac OS X, you would do well to read one or two.
> Michael David Crawford
> mdcrawford at gmail dot com
> GoingWare's Bag of Programming Tricks
> macports-users mailing list
> macports-users at lists.macosforge.org
More information about the macports-users