bash_profile problems, gcc/make/xcode tools problems

I've been encountering several weird problems with Leopard lately. I need to do some command line compiling and have been running into issues. I first installed Xcode tools to get gcc, make etc. However, the Xcode tools seemingly failed to modify bash_profile, as the Xcode tools directory is not included in the PATH.

g-mac:~ lindec$ PATH=$PATH\:/Xcode2.5/usr/bin ; export PATH

Fixes the issue with gcc here. However, I then installed MacPorts, and MacPorts apparently fails to modify bash_profile as well, as the "port" command will fail unless I modify the PATH by hand to include the MacPorts directory. This at least allowed me access to the "port" command. However, now MacPorts cannot compile anything because it claims make is missing! Here is the output:

g-mac:~ lindec$ port install py-mysql
---> Building zlib with target all
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/ opt_local_var_macports_sources_rsync.macports.org_release_ports_archiverszlib/work/zlib-1.2.3" && make all " returned error 127
Command output: sh: make: command not found

Error: The following dependencies failed to build: mysql5 openssl zlib python24 gettext expat libiconv gperf
Error: Status 1 encountered during processing.

What the heck is going on here??? I know this post could also be made on the MacPorts site, however I thought it prudent to be put here because I want to know why installations that are supposed to be setting PATH are not doing it and if that is causing my problem. Also, how do I permanently modify my bash_profile on Leopard so I dont have to keep reminding bash whenever I start a new terminal session.

Macbook Pro, Mac OS X (10.5.2)

Posted on May 18, 2008 4:33 PM

Reply
9 replies

May 18, 2008 6:55 PM in response to lindec

Xcode is not supposed to modify your PATH. It is up to you if you want to customize it. Do so by editing (or creating, if necessary) ~/.bash_profile.

However, you should be using Xcode 3.0 for Leopard. A standard install puts gcc, make, etc., into /usr/bin, which is already in the default PATH. Unless you customized the install, it should not be necessary to modify PATH.

May 18, 2008 8:02 PM in response to Jeffrey Jones2

A disclaimer - I am EXTREMELY new to programming and was simply trying to create a C++ Hello World program in Eclipse and was getting an error which I will not go into...

This error led me to search all kinds of posts regarding something that just might have something to do with this post. All the info I found indicated that the error was due to not having gcc, g++, and/or gmake installed.

I opened Terminal and tried to run commands like gcc --version or which gcc and got nothing or '-bash: gcc: command not found'.

The problem is from the finder, I can find 'gcc-4.0'. In addition 'gcc --version' does not work, but if I enter '/Developer/usr/bin/gcc --version' it works. It seems that /usr/bin (assuming we're talking about the same /usr/bin) is not the default path for me?

For reference, I've had XCode 3.0 installed for months, and the --version says I have gcc 4.0.1.

Please forgive me if I have no idea what you guys are talking about and I'm way off with this post!!



-John

May 22, 2008 9:08 PM in response to John Hendy

I agree John, this is the exact same problem I've had. In response to the poster that originally attempted to answer, in my case, something is clearly wrong with the path, maybe /usr/bin is not in my path. Because I've certainly got gcc, make and friends in my XCode directory, but they are inaccessible from the command line.

May 23, 2008 10:55 AM in response to Jeffrey Jones2

Here's what I've got...

$ echo $PATH
$ /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

Forgive my newness to all of this... are the colons separating different places to search?

Perhaps the problem is that I've found gcc in /Developer/usr/bin... NOT /usr/bin. I believe my problem is setting the $PATH to include the location of gcc. I found another post where someone seemed to have solved the problem by changing $PATH, but I don't know how to do this. Would you read the other post and see if you think that's my problem - if so, may I have instructions?

http://discussions.apple.com/message.jspa?messageID=7248755#7248755

Thanks!
-John

May 23, 2008 11:06 AM in response to Jeffrey Jones2

Actually, thank you for the reference to the About XCode doc. I found this paragraph:

'The XcodeTools 3.0 installer also optionally installs the standard system development tools and
interfaces into /usr, so conventional makefile- and config-based builds will operate correctly.'

I'm guessing that I missed this option or did not select it when I installed. It would seem that if I had directed XCode to put all necessary tools into /usr (vs. /Developer/usr/), I would be all set. I am uninstalling and will reinstall and post the results.

Thanks,
-John

May 23, 2008 4:54 PM in response to lindec

Ok, update. For some reason I had XCode 2.5 instead of 3.0 absentmindedly installed. I just installed XCode 3.0 and viola! I can access gcc and make happily right from the command line!! HOWEVER, something is still screwed up because I can't access my basic UNIX commands still. Can some please help me fix this?

g-mac:~ lindec$ gcc
i686-apple-darwin8-gcc-4.0.1: no input files
g-mac:~ lindec$ make
make: * No targets specified and no makefile found. Stop.
g-mac:~ lindec$ ls
-bash: ls: command not found
g-mac:~ lindec$

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

bash_profile problems, gcc/make/xcode tools problems

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.