我尝试为 Xcode 的应用版本更新此内容。这将展示如何安装完全支持 gcc 的 Xcode 4.4.x。
您需要:Mac OSX Lion - 这很重要,不要尝试使用 Mountain Lion!
您需要:Xcode 4.1 for Lion 的副本。使用您的开发帐户从 Apple 下载。暂时不要安装。
现在通过 Mac App Store 从 Apple 安装 Xcode 4.4.x。
完成此操作后,您的应用程序目录中将拥有 xcode 4.4.x。
根据用户权限,您必须使用管理员密码确认许多操作。只是在必要时这样做。如果你损坏了你的系统,那你就得靠你自己了(但这不应该发生,因为 Xcode 已经被应用了)。
通过鼠标右键单击“显示包内容”打开 Xcode 4.4.x,然后在此处导航到 gcc 4.2 插件:
/Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.2.xcplugin/Contents/Resources/
使用文本编辑器打开文件 gcc 4.2.xcspec。
查看第 41 行和第 42 行。确保它们看起来与此处显示的完全相同(在全新安装中,这些值将颠倒过来)。
ShowInCompilerSelectionPopup = YES;
IsNoLongerSupported = NO;
保存并关闭。
为 Lion 安装 Xcode 4.1。
现在导航到引导驱动器根目录下的开发者目录。
导航到 /Developer/Platforms/iPhoneOS.platform/Developer/usr/
使用 command-c 复制 usr 目录
切换回 xcode 4.4.x
导航到:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/
用 command-v 粘贴 usr 目录
现在 lion 将尝试合并这两个目录。确保按“保持更新”
与源重复:/Developer/Platforms/iPhoneSimulator.platform/Developer/usr
和目标:/Applications/Xcode.app/Contents/Developer/Platforms/usr
再次,合并并“保持更新”
导航到:/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib
现在选择 gcc 目录并使用 command-c 复制它
导航到 Xcode 4.4.x 应用程序:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/lib
用命令-v粘贴gcc目录
从 /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib 与 'info' 目录重复
目标再次是 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/lib
完成。启动 xcode 并在必要时在设置中选择 GCC 4.2。您应该删除过时的“开发人员”目录。
Xcode 现在也应该再次通过 Mac App Store 接受更新(这仍有待测试)。我也没有下载命令行工具,但我猜它也会继续存在。