有没有办法在OSX中安装gcc而不安装Xcode?

时间:2022-07-28 07:04:38

I've googled the hell out of it, and it seems like there is no way to install gcc on OS X without installing Xcode (which takes at leats 1.5GB of space). All I need is gcc and none of the other junk that comes with Xcode. And at this point, I'll take any other kind of C compiler.

我用谷歌搜索了它,似乎没有办法在OS X上安装gcc而不安装Xcode(占用1.5GB的空间)。我只需要gcc,而不是Xcode附带的其他垃圾。在这一点上,我将采取任何其他类型的C编译器。

I know I could simply install Xcode, but that is beside the point since I neither have my original installation disc nor a quick internet connection.

我知道我可以简单地安装Xcode,但这不是重点,因为我既没有原始安装光盘也没有快速的互联网连接。

So... does anyone have any suggestions?

那么......有没有人有任何建议?

EDIT: Sorry if I was unclear, but I need the headers as well. I'm currently installing gcc4 via fink and it's downloading the shared libraries as well. I'll update on the progress.

编辑:对不起,如果我不清楚,但我也需要标题。我目前正在通过fink安装gcc4,它也在下载共享库。我会更新进展情况。

EDIT 2: Ok, so I successfully installed gcc using fink. BUT, it's pretty much useless: "error: C compiler cannot create executables". After googling around, I found that not having Apple's Developer Tools installed is the cause of the error. Probably because I need all the libraries, headers, etc that are only available through Xcode.

编辑2:好的,所以我用fink成功安装了gcc。但是,它几乎没用:“错误:C编译器无法创建可执行文件”。谷歌搜索后,我发现没有安装Apple的开发者工具是导致错误的原因。可能是因为我需要所有只能通过Xcode获得的库,标题等。

9 个解决方案

#1


30  

Try the osx-gcc-installer on github.

在github上试试osx-gcc-installer。

#2


34  

Checkout command line tools for Xcode from apple. It's official support from apple to only create the command line tools.

来自apple的Xcode的Checkout命令行工具。苹果的官方支持只能创建命令行工具。

#3


7  

I've been doing this for a long time, and I've done things like this, and I've concluded it's simply never worth doing. :-(

我已经做了很长时间了,我做过这样的事情,我得出的结论是,它根本就不值得做。 :-(

The reason is that no one expects you to do such things, so there are assumptions all over the system that "everything" is there. You might not run into this today - or worse, you might not even realize later that this is the cause of your issues.

原因是没有人希望你做这样的事情,因此整个系统都假设“一切”都存在。你今天可能不会遇到这种情况 - 或者更糟糕的是,你可能以后甚至都没有意识到这是你问题的原因。

Instead of wasting your smart time on things like this which don't actually produce any working code you can use, following the approved method, run the download overnight, and spend your time instead on planning and writing the top-level code (you shouldn't need a compiler for that anyway!)

而不是浪费你的聪明时间在这样的事情上,这些事实上不会产生你可以使用的任何工作代码,按照批准的方法,一夜之间运行下载,并花时间来计划和编写*代码(你不应该无论如何都不需要编译器!)

#4


3  

I'm fairly certain that this is not possible. However, I'm also not sure if you need the whole developer suite to get the developer tools installed. Quite a few tools get installed along with XCode that might be optional. However, I think you're out of luck for not needing to bite the bullet and use wget or DownThemAll or some other download manager that will let you slowly download the developer tools in chunks.

我很确定这是不可能的。但是,我也不确定您是否需要整个开发人员套件来安装开发人员工具。与XCode一起安装了很多工具,这些工具可能是可选的。但是,我认为你不需要咬紧牙关并使用wget或DownThemAll或其他一些下载管理器让你慢慢下载开发人员工具。

Whenever I install OS X I install the developer tools as a rule, just because it opens up the world of available software tremendously. Perhaps you should consider doing this in the future as well.

每当我安装OS X时,我都会安装开发人员工具,因为它极大地打开了可用软件的世界。也许您应该考虑将来也这样做。

#5


2  

The first thing you want to try is called Pacifist - what Pacifist lets you do is to open a large package (such as XCode) and to access parts of it directly. I'm pretty sure you'll be able to find a smaller package inside the XCode package that just has gcc.

你要尝试的第一件事叫做Pacifist - Pacifist让你做的是打开一个大包(比如XCode)并直接访问它的一部分。我很确定你能够在只有gcc的XCode包中找到一个更小的包。

HOWEVER it's not clear to me that this is the best route. If you are planning to do Cocoa or Carbon developing I strongly suggest installing the entire package because you will need all the documentation and headers. If you're only planning on doing command-line stuff, you still may find you need to poke around inside XCode to identify all the packages you will need - things such as libraries, headers, man pages and so on.

然而,我不清楚这是最好的路线。如果您计划进行Cocoa或Carbon开发,我强烈建议您安装整个软件包,因为您需要所有文档和标题。如果你只是计划做命令行的事情,你仍然可能会发现你需要在XCode中找到你需要的所有软件包 - 例如库,标题,手册页等等。

All in all you're probably still better off installing the whole thing - if HD space is really tight (because you're on a tiny old iMac for example) then look at tools like Monolingual - Monolingual removes all the international support from all the various OS X applications, which can easily reduce the size of an application by 50%.

总而言之,你可能还是更好的安装整个东西 - 如果高清空间真的很紧(因为你在一个很小的老iMac上)然后看看像Monolingual这样的工具 - Monolingual取消了所有国际支持各种OS X应用程序,可以轻松地将应用程序的大小减少50%。

#6


1  

There's fink and MacPorts, if you want an easy installer/updater.

如果你想要一个简单的安装程序/更新程序,那就是fink和MacPorts。

#7


0  

Install the GCC package from the Packages directory in Xcode's disk image and you'll have just GCC. Note that of course you won't have autotools or other standard build tools, for which you will have to install more packages from that folder.

从Xcode的磁盘映像中的Packages目录安装GCC包,你将只有GCC。请注意,您当然不会有autotools或其他标准构建工具,您必须从该文件夹安装更多软件包。

#8


0  

I found this googling around that appears to install it without XCode.

我发现这个谷歌搜索似乎安装它没有XCode。

#9


#1


30  

Try the osx-gcc-installer on github.

在github上试试osx-gcc-installer。

#2


34  

Checkout command line tools for Xcode from apple. It's official support from apple to only create the command line tools.

来自apple的Xcode的Checkout命令行工具。苹果的官方支持只能创建命令行工具。

#3


7  

I've been doing this for a long time, and I've done things like this, and I've concluded it's simply never worth doing. :-(

我已经做了很长时间了,我做过这样的事情,我得出的结论是,它根本就不值得做。 :-(

The reason is that no one expects you to do such things, so there are assumptions all over the system that "everything" is there. You might not run into this today - or worse, you might not even realize later that this is the cause of your issues.

原因是没有人希望你做这样的事情,因此整个系统都假设“一切”都存在。你今天可能不会遇到这种情况 - 或者更糟糕的是,你可能以后甚至都没有意识到这是你问题的原因。

Instead of wasting your smart time on things like this which don't actually produce any working code you can use, following the approved method, run the download overnight, and spend your time instead on planning and writing the top-level code (you shouldn't need a compiler for that anyway!)

而不是浪费你的聪明时间在这样的事情上,这些事实上不会产生你可以使用的任何工作代码,按照批准的方法,一夜之间运行下载,并花时间来计划和编写*代码(你不应该无论如何都不需要编译器!)

#4


3  

I'm fairly certain that this is not possible. However, I'm also not sure if you need the whole developer suite to get the developer tools installed. Quite a few tools get installed along with XCode that might be optional. However, I think you're out of luck for not needing to bite the bullet and use wget or DownThemAll or some other download manager that will let you slowly download the developer tools in chunks.

我很确定这是不可能的。但是,我也不确定您是否需要整个开发人员套件来安装开发人员工具。与XCode一起安装了很多工具,这些工具可能是可选的。但是,我认为你不需要咬紧牙关并使用wget或DownThemAll或其他一些下载管理器让你慢慢下载开发人员工具。

Whenever I install OS X I install the developer tools as a rule, just because it opens up the world of available software tremendously. Perhaps you should consider doing this in the future as well.

每当我安装OS X时,我都会安装开发人员工具,因为它极大地打开了可用软件的世界。也许您应该考虑将来也这样做。

#5


2  

The first thing you want to try is called Pacifist - what Pacifist lets you do is to open a large package (such as XCode) and to access parts of it directly. I'm pretty sure you'll be able to find a smaller package inside the XCode package that just has gcc.

你要尝试的第一件事叫做Pacifist - Pacifist让你做的是打开一个大包(比如XCode)并直接访问它的一部分。我很确定你能够在只有gcc的XCode包中找到一个更小的包。

HOWEVER it's not clear to me that this is the best route. If you are planning to do Cocoa or Carbon developing I strongly suggest installing the entire package because you will need all the documentation and headers. If you're only planning on doing command-line stuff, you still may find you need to poke around inside XCode to identify all the packages you will need - things such as libraries, headers, man pages and so on.

然而,我不清楚这是最好的路线。如果您计划进行Cocoa或Carbon开发,我强烈建议您安装整个软件包,因为您需要所有文档和标题。如果你只是计划做命令行的事情,你仍然可能会发现你需要在XCode中找到你需要的所有软件包 - 例如库,标题,手册页等等。

All in all you're probably still better off installing the whole thing - if HD space is really tight (because you're on a tiny old iMac for example) then look at tools like Monolingual - Monolingual removes all the international support from all the various OS X applications, which can easily reduce the size of an application by 50%.

总而言之,你可能还是更好的安装整个东西 - 如果高清空间真的很紧(因为你在一个很小的老iMac上)然后看看像Monolingual这样的工具 - Monolingual取消了所有国际支持各种OS X应用程序,可以轻松地将应用程序的大小减少50%。

#6


1  

There's fink and MacPorts, if you want an easy installer/updater.

如果你想要一个简单的安装程序/更新程序,那就是fink和MacPorts。

#7


0  

Install the GCC package from the Packages directory in Xcode's disk image and you'll have just GCC. Note that of course you won't have autotools or other standard build tools, for which you will have to install more packages from that folder.

从Xcode的磁盘映像中的Packages目录安装GCC包,你将只有GCC。请注意,您当然不会有autotools或其他标准构建工具,您必须从该文件夹安装更多软件包。

#8


0  

I found this googling around that appears to install it without XCode.

我发现这个谷歌搜索似乎安装它没有XCode。

#9