使用 RVM 的 Mac OS X Lion Xcode 问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6848035/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 21:34:39  来源:igfitidea点击:

Mac OS X Lion Xcode problems using RVM

rubyxcodexcode4rvmosx-lion

提问by holden

I had Xcode 4.1 preview 5 working fine but decided to upgrade to the final xcode 4.1 thru the App store. I uninstalled Xcode first...

我让 Xcode 4.1 preview 5 工作正常,但决定通过 App Store 升级到最终的 xcode 4.1。我先卸载了Xcode...

sudo /Developer/Library/uninstall-devtools –mode=all

Then installed Xcode thru the app store and rebooted.

然后通过应用商店安装 Xcode 并重新启动。

I also removed RVM completely but... now whenever I try and install a version of Ruby it fails. In the error file i get this:

我也完全删除了 RVM 但是...现在每当我尝试安装一个 Ruby 版本时它都会失败。在错误文件中,我得到了这个:

[2011-07-27 18:29:25]  ./configure --prefix="/Users/holden/.rvm/usr"  
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... no
checking for gcc... /usr/bin/gcc-4.2
checking whether the C compiler works... no
configure: error: in `/Users/holden/.rvm/src/yaml-0.1.4':
configure: error: C compiler cannot create executables
See `config.log' for more details

There is no gcc-4.2 or any other gcc in the /usr/bin directory.

/usr/bin 目录中没有 gcc-4.2 或任何其他 gcc。

What's up with Xcode?

Xcode 怎么了?

回答by holden

Apparently even after downloading and "installing" XCode from the Appstore and despite the long process after downloading where it appears to install it and the words "Installed" eventually become displayed next to it in the store. You must still manually install it again within your applications folder before it will work.

显然,即使在从 Appstore 下载并“安装”XCode 之后,尽管下载后似乎安装它的过程很长,并且“已安装”字样最终会在商店中显示在它旁边。您仍然必须在应用程序文件夹中再次手动安装它,然后它才能工作。

Odd.

奇怪的。

回答by gmaliar

Just bought a Mac, what I had to do to make it work after installing Xcode and seeing that /usr/bin doesn't have gcc, was: Enter Xcode preferences going over to the downloads tab and install Command Line Tools. After setting up my developer account and downloading the tools I opened terminal and typed

刚买了一台 Mac,在安装 Xcode 并看到 /usr/bin 没有 gcc 后,我必须做的事情是:输入 Xcode 首选项,转到下载选项卡并安装命令行工具。设置我的开发者帐户并下载工具后,我打开终端并输入

rvm install 1.9.3 --with-gcc=clang

and everything compiled and works.

和一切编译和工作。

回答by thewoolleyman

Note - after running "Install Xcode" I still only have "gcc" in /usr/bin, not gcc-4.2. But still worked fine, /usr/bin/gcc was a symlink to /usr/bin/llvm-gcc-4.2

注意 - 运行“安装 Xcode”后,我在 /usr/bin 中仍然只有“gcc”,而不是 gcc-4.2。但仍然工作正常,/usr/bin/gcc 是 /usr/bin/llvm-gcc-4.2 的符号链接

回答by deepwinter

Guy's answer above seems to fix the problem compiling Ruby in RVM with XCode 4.2 installed completely, and removed for me to install GCC from https://github.com/kennethreitz/osx-gcc-installer. This is preferable for users needing to have both RVM and XCode 4.2 installed.

上面盖伊的回答似乎解决了在完全安装了 XCode 4.2 的情况下在 RVM 中编译 Ruby 的问题,并删除了我从https://github.com/kennethreitz/osx-gcc-installer安装 GCC 的问题。这对于需要同时安装 RVM 和 XCode 4.2 的用户来说是可取的。