OS X 上没有 Xcode 的 GCC

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/583360/
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 18:29:17  来源:igfitidea点击:

GCC without Xcode on OS X

xcodemacosgcc

提问by Konrad Rudolph

I've just unwrapped my new MacBook Pro (yay!) and am now setting it up properly for development. Since I want to avoid clutter, I'm wondering if I really need to install the Xcode tools at all (I never use the IDE or Mac specific tools), since I'll install a newer version of GCC anyway, using MacPorts.

我刚刚解开我的新的MacBook Pro(!),我现在将其设置为正常发展。由于我想避免混乱,我想知道我是否真的需要安装 Xcode 工具(我从不使用 IDE 或 Mac 特定工具),因为无论如何我都会使用MacPorts安装更新版本的 GCC 。

So, is there any benefit in installing Xcode? Is it necessary? What kind of set-up does it do behind the scenes? Basically: can I skip this or will it come back to haunt me because some Unix development tools just assume that OS X is always set up in this way?

那么,安装 Xcode 有什么好处吗?有必要吗?它在幕后做了什么样的设置?基本上:我可以跳过这个还是它会回来困扰我,因为一些 Unix 开发工具只是假设 OS X 总是以这种方式设置?

回答by Jeremy L

In order to perform an easy and successful install of MacPorts, already having tools from the xCode installer is necessary. You only need the install option that places a copy of the unix/header files outside of xcode; everything else can remain uninstalled.

为了轻松成功地安装 MacPorts,必须已经拥有来自 xCode 安装程序的工具。您只需要在 xcode 之外放置 unix/头文件副本的安装选项;其他一切都可以保持卸载。

回答by shanemcd

A friend of mine recently released this:

我的一个朋友最近发布了这个:

https://github.com/kennethreitz/osx-gcc-installer

https://github.com/kennethreitz/osx-gcc-installer

Have fun :)

玩得开心 :)

回答by Charlie Martin

I tried this trick and I was constantly chasing missing header files and such. Just install XCode.

我尝试了这个技巧,并且一直在寻找丢失的头文件等。只需安装 XCode。

回答by Can Berk Güder

First of all, congratulations on the new MBP. I recently bought a 15" unibody myself. =)

首先,祝贺新的MBP。我最近自己买了一个 15" 一体式机身。=)

You can safely skip Xcode installation, and you can install almost everything Xcode installs through MacPorts, except Xcode itself, of course.

您可以安全地跳过 Xcode 安装,当然,除了 Xcode 本身,您还可以通过 MacPorts 安装几乎所有 Xcode 安装的东西。

However, I believe you'll find yourself installing Xcode one day anyway, and installing Xcode is much easier than installing all the tools (especially GCC) through MacPorts.

但是,我相信您终有一天会发现自己安装了 Xcode,而且安装 Xcode 比通过 MacPorts 安装所有工具(尤其是 GCC)要容易得多。

回答by dirkgently

We primarily use the Xcode IDE for building Cocoa/Carbon applications. Xcode typically has different project templates (and project settings fixed accordingly). As long as you are not going to generate a Universal Binary or a framework I think you should be ok. As far as I am concerned, when I am too pissed with Xcode, I go back to the command line, set up the paths myself and start using GDB.

我们主要使用 Xcode IDE 来构建 Cocoa/Carbon 应用程序。Xcode 通常有不同的项目模板(项目设置也相应地固定)。只要您不打算生成通用二进制文件或框架,我认为您应该没问题。就我而言,当我对 Xcode 太生气时,我会回到命令行,自己设置路径并开始使用 GDB。

回答by dbr

You can strip down the Xcode install quite a lot - when you install Xcode there is a "Customise" button where you can remove a lot of stuff (gigabytes worth).

您可以删除很多 Xcode 安装 - 当您安装 Xcode 时,有一个“自定义”按钮,您可以在其中删除很多东西(价值千兆字节)。

You can also go in and delete stuff from /Developer/, for example the 10.3 SDK is about 150MB (I think), and if you're not writing software for that it's quite safe to delete. Obviously be careful when deleting, but if you break things, you can always reinstall the Developer Tools!

您还可以从 中删除内容/Developer/,例如 10.3 SDK 大约为 150MB(我认为),如果您不是为此编写软件,删除它是非常安全的。显然删除时要小心,但如果你破坏了东西,你总是可以重新安装开发者工具!

回答by Brandan

Apple now provides the command line tools as a separate download from Xcode. They work with Lion and Mountain Lion. You can download them from the Apple Developer Center.

Apple 现在提供命令行工具作为 Xcode 的单独下载。他们与 Lion 和 Mountain Lion 合作。您可以从 Apple Developer Center 下载它们

(This is noted on the osx-gcc-installer GitHub page.)

(这在 osx-gcc-installer GitHub 页面上有说明。)