How to use/install gcc on Mac OS X 10.8 / Xcode 4.4

I have install Mountain Lion (Mac OS X 10.8) and now gcc doesn't seem to be available anymore. I've also installed Xcode 4.4 so there is no more /Developer directory.

I need gcc both for mac ports and for ruby gems (that have native extensions).

Does Xcode 4.4 include gcc or is there a way to install gcc?


Update:

You can now just run the following command from your terminal:

xcode-select --install

Starting with Xcode 4.3 - you must now manually install command line tools from Xcode menu > Preferences > Downloads .

手动安装图像

Alternatively, there are stand-alone installation packages both for Mountain Lion (10.8) and for Mavericks (10.9).

This package enables UNIX-style development via Terminal by installing command line developer tools, as well as Mac OS X SDK frameworks and headers. Many useful tools are included, such as the Apple LLVM compiler, linker, and Make. If you use Xcode, these tools are also embedded within the Xcode IDE, and can be installed on your system using the Downloads preferences pane within Xcode 4.3 and later. This package requires Mac OS X 10.7.3 or later.


I found that after upgrading from Lion my install was failing because it was looking for GCC in /usr/bin/gcc-4.2. Now the default installation path is /usr/bin/gcc.

My error looked like this:

make: /usr/bin/gcc-4.2: No such file or directory

A symlink will sort out the issue:

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2

Just paste this into terminal:

export PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH

I hope that helps!

链接地址: http://www.djcxy.com/p/15042.html

上一篇: 有什么区别

下一篇: 如何在Mac OS X 10.8 / Xcode 4.4上使用/安装gcc