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.
我已经安装了Mountain Lion (Mac OS X 10.8),现在已经没有gcc了。我还安装了Xcode 4.4,因此不再有/Developer目录。
I need gcc both for mac ports and for ruby gems (that have native extensions).
对于mac端口和ruby gems(具有本地扩展),我需要gcc。
Does Xcode 4.4 include gcc or is there a way to install gcc?
Xcode 4.4是否包括gcc或者是否有安装gcc的方法?
9 个解决方案
#1
414
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
.
从Xcode 4.3开始——现在必须手动安装命令行工具,从Xcode菜单>首选项>下载。
Alternatively, there are stand-alone installation packages both for Mountain Lion (10.8) and for Mavericks (10.9).
另外,对于Mountain Lion(10.8)和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.
通过安装命令行开发工具,以及Mac OS X SDK框架和头文件,这个包可以通过终端实现unix风格的开发。包括许多有用的工具,比如苹果LLVM编译器、链接器和Make。如果您使用Xcode,这些工具也会嵌入到Xcode IDE中,并且可以在您的系统上安装,使用Xcode 4.3和稍后的下载preferences窗格。这个软件包需要Mac OS X 10.7.3或更高版本。
#2
41
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.
我发现,从Lion升级后,我的安装失败了,因为它在/usr/bin/ GCC -4.2中寻找GCC。现在默认的安装路径是/ 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
#3
23
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!
我希望会有帮助!
#4
21
pre-1.9.3 Ruby on Mountain Lion
1.9.3 Ruby on Mountain Lion。
Pre-requisites
的必备条件
Xcode 4.4,
Xcode Command Line Tools
Homebrew
XQuartz 2.7.2 or later.
rbenv/ruby-build or RVM.
Install GCC
安装GCC
Note, the Xcode Command Line Tools do not include GCC, they include LLVM-GCC. Same-same, but different.
注意,Xcode命令行工具不包括GCC,它们包括LLVM-GCC。相同,但不同。
$ brew tap homebrew/dupes
$ brew install apple-gcc42
Add the following to your ~/.profile or equivalent:
将以下内容添加到您的~/中。概要文件或相关:
export CC=/usr/local/bin/gcc-4.2
And reload your shell before attempting the install commands below.
在尝试下面的安装命令之前重新加载您的shell。
Install RVM
安装区
CFLAGS="-I/opt/X11/include" rvm reinstall ree
Install Ruby
安装Ruby
Prefix the install command with CFLAGS="-I/opt/X11/include"
Then to set your new ruby as default:
然后将新的ruby设置为默认值:
user$ rvm use 1.9.2 --default
Then check your ruby version:
然后检查你的ruby版本:
user$ ruby -v
#5
12
For users who can download from Apple a build of Xcode, but not the command line tools
An accepted answer to a comparable question suggests kennethreitz / osx-gcc-installer. In that 'OSX GCC Installer' area, the first of two options is pre-built binaries — for Snow Leopard and for Lion, but not for Mountain Lion. Considering what's included, I should not recommend using that project's GCC-10.7-v2.pkg after installing version 4.4 of Xcode on any build of 10.8.
对一个类似问题的公认答案是:kennethreitz / osx-gcc-installer。在这个“OSX GCC安装程序”区域中,两个选项中的第一个是预先构建的二进制文件——用于雪豹和狮子,而不是用于美洲狮。考虑到包含的内容,我不建议使用该项目的GCC-10.7-v2。在安装了10.8版本的Xcode版本4.4之后,pkg。
The more relevant option is build your own, with reference to Apple open source for Developer Tools.
更相关的选项是建立您自己的,参考苹果开放源码的开发工具。
Sources for GCC, compatibility with 10.8
Apple Open Source for the most recently published Developer Tools 4.3 is without GCC. The source for GCC in the 4.1 area may be too old for use with 10.8.
最新发布的开发者工具4.3的苹果开源软件没有GCC。在4.1领域中,GCC的源代码可能太旧,不能使用10.8。
GCC home page for the most recent release.
最新版本的GCC主页。
Build status for GCC 4.7 links to results for x86_64-apple-darwin10.8.0 …
构建GCC 4.7链接的状态,结果是x86_64-apple-达尔文10.8.0…
#6
5
Apple provides an .mpkg
installer for the Command Line Tools (CLT), but they don't normally expose the link. It includes GCC. You can install it without downloading/installing XCode.
苹果为命令行工具(CLT)提供了一个.mpkg安装程序,但通常不会公开该链接。它包括GCC。您可以在不下载/安装XCode的情况下安装它。
Download Command Line Tools w/ GCC here.
在这里下载命令行工具w/ GCC。
#7
3
You can compile it yourself with this Makefile. If you want to save yourself 2-5 hours, I created a signed installer package with GCC 4.7.2 for Mac OSX Mountain Lion which you can download here.
您可以自己编译这个Makefile。如果你想节省2-5个小时,我用GCC 4.7.2为Mac OSX Mountain Lion创建了一个有签名的安装程序包,你可以在这里下载。
#8
1
You can download the installer(.pkg file) lattest version of GCC for Mountain Lion from this site. You simpy need to download and install it.
您可以下载安装程序(。(pkg文件)这个站点的Mountain Lion的GCC版本。您需要下载并安装它。
https://github.com/kennethreitz/osx-gcc-installer/downloads
https://github.com/kennethreitz/osx-gcc-installer/downloads
#9
0
I'm using OS X 10.9 Mavericks. I only happened to type gcc -v. The system downloaded gcc immediately. Installation completed without Xcode being installed at all. Testing "Hello, world!" works.
我使用的是OS X 10.9 Mavericks。我只是碰巧键入gcc -v。系统立即下载了gcc。安装完成时没有安装Xcode。测试“Hello,world !”的作品。
#1
414
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
.
从Xcode 4.3开始——现在必须手动安装命令行工具,从Xcode菜单>首选项>下载。
Alternatively, there are stand-alone installation packages both for Mountain Lion (10.8) and for Mavericks (10.9).
另外,对于Mountain Lion(10.8)和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.
通过安装命令行开发工具,以及Mac OS X SDK框架和头文件,这个包可以通过终端实现unix风格的开发。包括许多有用的工具,比如苹果LLVM编译器、链接器和Make。如果您使用Xcode,这些工具也会嵌入到Xcode IDE中,并且可以在您的系统上安装,使用Xcode 4.3和稍后的下载preferences窗格。这个软件包需要Mac OS X 10.7.3或更高版本。
#2
41
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.
我发现,从Lion升级后,我的安装失败了,因为它在/usr/bin/ GCC -4.2中寻找GCC。现在默认的安装路径是/ 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
#3
23
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!
我希望会有帮助!
#4
21
pre-1.9.3 Ruby on Mountain Lion
1.9.3 Ruby on Mountain Lion。
Pre-requisites
的必备条件
Xcode 4.4,
Xcode Command Line Tools
Homebrew
XQuartz 2.7.2 or later.
rbenv/ruby-build or RVM.
Install GCC
安装GCC
Note, the Xcode Command Line Tools do not include GCC, they include LLVM-GCC. Same-same, but different.
注意,Xcode命令行工具不包括GCC,它们包括LLVM-GCC。相同,但不同。
$ brew tap homebrew/dupes
$ brew install apple-gcc42
Add the following to your ~/.profile or equivalent:
将以下内容添加到您的~/中。概要文件或相关:
export CC=/usr/local/bin/gcc-4.2
And reload your shell before attempting the install commands below.
在尝试下面的安装命令之前重新加载您的shell。
Install RVM
安装区
CFLAGS="-I/opt/X11/include" rvm reinstall ree
Install Ruby
安装Ruby
Prefix the install command with CFLAGS="-I/opt/X11/include"
Then to set your new ruby as default:
然后将新的ruby设置为默认值:
user$ rvm use 1.9.2 --default
Then check your ruby version:
然后检查你的ruby版本:
user$ ruby -v
#5
12
For users who can download from Apple a build of Xcode, but not the command line tools
An accepted answer to a comparable question suggests kennethreitz / osx-gcc-installer. In that 'OSX GCC Installer' area, the first of two options is pre-built binaries — for Snow Leopard and for Lion, but not for Mountain Lion. Considering what's included, I should not recommend using that project's GCC-10.7-v2.pkg after installing version 4.4 of Xcode on any build of 10.8.
对一个类似问题的公认答案是:kennethreitz / osx-gcc-installer。在这个“OSX GCC安装程序”区域中,两个选项中的第一个是预先构建的二进制文件——用于雪豹和狮子,而不是用于美洲狮。考虑到包含的内容,我不建议使用该项目的GCC-10.7-v2。在安装了10.8版本的Xcode版本4.4之后,pkg。
The more relevant option is build your own, with reference to Apple open source for Developer Tools.
更相关的选项是建立您自己的,参考苹果开放源码的开发工具。
Sources for GCC, compatibility with 10.8
Apple Open Source for the most recently published Developer Tools 4.3 is without GCC. The source for GCC in the 4.1 area may be too old for use with 10.8.
最新发布的开发者工具4.3的苹果开源软件没有GCC。在4.1领域中,GCC的源代码可能太旧,不能使用10.8。
GCC home page for the most recent release.
最新版本的GCC主页。
Build status for GCC 4.7 links to results for x86_64-apple-darwin10.8.0 …
构建GCC 4.7链接的状态,结果是x86_64-apple-达尔文10.8.0…
#6
5
Apple provides an .mpkg
installer for the Command Line Tools (CLT), but they don't normally expose the link. It includes GCC. You can install it without downloading/installing XCode.
苹果为命令行工具(CLT)提供了一个.mpkg安装程序,但通常不会公开该链接。它包括GCC。您可以在不下载/安装XCode的情况下安装它。
Download Command Line Tools w/ GCC here.
在这里下载命令行工具w/ GCC。
#7
3
You can compile it yourself with this Makefile. If you want to save yourself 2-5 hours, I created a signed installer package with GCC 4.7.2 for Mac OSX Mountain Lion which you can download here.
您可以自己编译这个Makefile。如果你想节省2-5个小时,我用GCC 4.7.2为Mac OSX Mountain Lion创建了一个有签名的安装程序包,你可以在这里下载。
#8
1
You can download the installer(.pkg file) lattest version of GCC for Mountain Lion from this site. You simpy need to download and install it.
您可以下载安装程序(。(pkg文件)这个站点的Mountain Lion的GCC版本。您需要下载并安装它。
https://github.com/kennethreitz/osx-gcc-installer/downloads
https://github.com/kennethreitz/osx-gcc-installer/downloads
#9
0
I'm using OS X 10.9 Mavericks. I only happened to type gcc -v. The system downloaded gcc immediately. Installation completed without Xcode being installed at all. Testing "Hello, world!" works.
我使用的是OS X 10.9 Mavericks。我只是碰巧键入gcc -v。系统立即下载了gcc。安装完成时没有安装Xcode。测试“Hello,world !”的作品。