Where is gcc on OSX? I have installed Xcode alread

2020-02-13 09:33发布

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's 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

标签: xcode macos gcc
8条回答
干净又极端
2楼-- · 2020-02-13 09:57

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

查看更多
Evening l夕情丶
3楼-- · 2020-02-13 09:58

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...

查看更多
祖国的老花朵
4楼-- · 2020-02-13 10:01

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.

查看更多
趁早两清
5楼-- · 2020-02-13 10:04

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.

查看更多
forever°为你锁心
6楼-- · 2020-02-13 10:06

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
[..]
查看更多
够拽才男人
7楼-- · 2020-02-13 10:14

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

查看更多
登录 后发表回答