开发者

Where is gcc on OSX? I have installed Xcode already

I have installed Xcode from the Tool cd, I thought that would let me use gcc from the command line but I can't find it.

What am I missing

EDIT

When I wrote I can't find it I meant "I look for it using which gcc"

If gcc would have been in the PATH in first place, which would have find it.

Since gcc is not in the PATH ( that'开发者_如何学JAVAs what brought me here in first place ) which won't find it!

I think that was obvious but I'm making the note here because it wasn't


As of version 4.3.1, XCode is now an application and the command line tools are now available through the Preferences (this is documented in the App Store for XCode under 'What's New in Version 4.3.1' if you click 'More...'). After installing XCode, open it, open the Preferences and click on the Download tab. Click on 'install' for the 'Command Line Tools' and then sign in with your computer's password. The code will then be downloaded and installed.


You didn't check the box that says "UNIX Development Support"[1] (or possibly you unchecked it; I can't remember if it's on by default or not) when you did the install, so it didn't install the necessary symlinks and drivers in /usr/bin/.

Reinstall, and make sure to read the descriptions of the configuration options and select the ones that you need.

1: "Optional content to allow command-line development from the boot volume. Installs a duplicate of the GCC compiler and command line tools blah blah blah..."


Something went wrong with your install.

gcc is installed under /usr/bin with a symlink to gcc-4.2:

cd diciu$ pkgutil --file-info /usr/bin/gcc-4.2 
volume: /
path: /usr/bin/gcc-4.2

pkgid: com.apple.pkg.gcc4.2Leo
pkg-version: 4.2.0.9000000000.1.1249367152
[..]
pkgid: com.apple.pkg.Xcode3.2.1Update
pkg-version: 1.0.1.1249367152
[..]
pkgid: com.apple.pkg.Xcode3.2.1UpdateUNIXDevSupport
pkg-version: 1.0.1.1249367152
[..]


On my Mac $ which gcc displays /usr/bin/gcc.


Xcode 4.3+ you need to install 'Command Line Tools for Xcode' found here: https://developer.apple.com/downloads


Is it possible that rather than not having gcc installed, your $PATH variable is messed up? first check if gcc is in /usr/bin manually. Then echo $PATH...


The same thing happened to me. It worked for a while and then went away. Reinstall and it will be fixed.

You might want to download Xcode from Apple while you are at it. Almost guaranteed to be fresher / more up-to-date since Xcode is rapidly updated. Current Xcode is 3.2.1.10. You need an Apple ID to download, but that also gives you access to the development site. All free... .


It is 1/6/2014. Current Xcode is 5.0.1


It is 2016 -- Current Xcode is 8.0. I think this question should be closed now.


Yes, try to install 'command line tools' by clicking Preferences-Downloads-command line tools.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜