20

I'd like to install gcc to Mac OS X Leopard, and compile some software from source using MacPorts. As http://www.macports.org/install.php has suggested, I've registered as an Apple developer. Now I have to download the Xcode developer tools, but it seems to be enormous. Is such a big download (3.5GB or 1GB) really necessary just for gcc and some header files (mostly for console applications)? Is there a smaller download (possibly on some other site) which would work? Did I find the proper download (Xcode Developer Tools), as required by the MacPorts website?

I don't need an IDE, I don't need any iOS-related software, I don't need big SDKs, I don't want to do any GUI programming.

I don't have an install disk.

There was a similar question Is there a way to install gcc in OSX without installing Xcode? . My question is different, because I wouldn't mind downloading and istalling parts of Xcode to get gcc, as long as it's reasonably large, say 300 MB uncompressed. Is that possible?

At http://developer.apple.com/devcenter/mac/index.action I've found the download link http://developer.apple.com/ios/download.action?path=/ios/ios_sdk_4.2__final/xcode_3.2.5_and_ios_sdk_4.2_final.dmg , which is a 3.5GB download. Based on some answers below, I noticed that Xcode 3.2.5 is for Snow Leopard, and I need Xcode 3.1.4 (1GB) for Leopard, which I can get from http://connect.apple.com/ (titled Downloads and ADC Program Assets) after registration and logging in, clicking on the section Downloads / Developer Tools, then finding Xcode 3.1.4 Developer Tools. The download link is http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/download?path=%2FDeveloper_Tools%2Fxcode_3.1.4_developer_tools%2Fxcode314_2809_developerdvd.dmg .

Community
  • 1
  • 1
pts
  • 80,836
  • 20
  • 110
  • 183
  • 1
    Once you have the Xcode 3.1.4 DVD image, you don't need to install everything in the XcodeTools.mpkg, either. I opened the Packages folder in that disk image, then installed these individual packages: DevSDK.pkg, DeveloperToolsCLI.pkg, gcc4.0.pkg, gcc4.2.pkg, llvm-gcc4.2.pkg. Maybe not all of those are necessary, but those are what I used. Afterwards, I was able to use gcc for what I wanted. (Building wget.) – Mr. Lance E Sloan May 17 '12 at 14:17

8 Answers8

21

Maybe this one is right for you: https://github.com/kennethreitz/osx-gcc-installer

I'm using homebrew and everything is fine: http://blog.strug.de/2011/09/homebrew-without-xcode-save-15-gb/

Mike
  • 58,961
  • 76
  • 175
  • 221
leif
  • 301
  • 3
  • 3
  • 1
    Thanks for the links. Unfortunately, there is no Leopard (10.5) version. – pts Sep 12 '11 at 11:01
  • 1
    Thanks for the links. Was exactly searching for this. Xcode is overkill for my tasks too. – Sathish Oct 21 '11 at 17:55
  • 1
    Same problem. Needed GCC for 10.5.5 How does anyone actually get any work done on Apple? Two seconds to install GCC on any Linux flavor. Hours spent on OSX already trying to solve this problem. –  May 11 '13 at 08:37
7

Apple released the command line tools for Xcode in 2012 Feb, the URL: https://developer.apple.com/downloads/index.action?=command%20line%20tools

This tool package includes make and gcc, I searched for a very long time, and finally, Apple released it.

If you download Xcode 4.3 from AppStore for Mac, since the Xcode is packed as Xcode.app and placed in /Application folder, you will have no chance to use the LLVM compiler, nor make utility from the command line.

So, download this package now, if you use Mac OSX Lion (Mac OSX 10.7.3 required), and you need to install some utilities, e.g., mySQL and php mCrpyt module, etc.

Quote from the Apple download site:

This package enables UNIX-style development via Terminal by installing command line developer tools, as well as Mac OSX 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 with the Xcode IDE, and can be installed on your system using the Downloads preferences pane with Xcode 4.3 and later. This package requires Mac OS X 10.7.3 or later.

Community
  • 1
  • 1
Dennies Chang
  • 564
  • 5
  • 15
  • 1
    Thank you for your informative answer. Unfortunately it doesn't answer my question, because I'm looking for a solution on Mac OS X Leopard, and your answer applies to Mac OS X 10.7.3 or later. +1ed it anyway. – pts Mar 11 '12 at 08:06
3

If you don't have Xcode on a system restore disk, retail copy of OS X, or as an optional installer on your hard drive, you will need to download the appropriate Xcode package for Leopard. Xcode 3.2.5 is only for Snow Leopard, OS X 10.6. For 10.5, the most recent Xcode is 3.1.4 (I believe) which is a 993MB download. When logged in, you should find it in your Developer Download and ADC Program Assets section of the Developer Connection website (you may have to search a bit to find that, though).

Note the Apple-supplied GCC has a number of Apple-developed enhancements, particularly in the area of multi-architecture support, that some open-source projects, in particular, Python, depend on. You may be able to get things to work with a vanilla GCC but is it worth your time and hassle to hack around and test and guess?

Ned Deily
  • 83,389
  • 16
  • 128
  • 151
  • Note, that this answer only applies to the question posed, i.e. for OS X 10.5 Leopard. There are other Xcode options for newer releases, i.e. 10.6 and 10.7. – Ned Deily May 21 '12 at 18:47
2

GCC is available as a binary package from fink, the other OS X package manager.

Wooble
  • 87,717
  • 12
  • 108
  • 131
  • Does it have all the header files so I can compile e.g. Python in it? – pts Dec 05 '10 at 17:47
  • Fink also has a full set of libraries available, if the main GCC package doesn't install something you need to build another package. I don't know off the top of my head what Python needs to build. (Of course, you could just install python from fink too unless you have a good reason to want to build your own...) – Wooble Dec 05 '10 at 20:27
  • time waste. It took me hours to install on 10.5 and I till can not install gcc through fink. – kellogs Jan 13 '13 at 19:01
  • The fink website says "Although a Developer Tools/Xcode Tools version usually comes with your OS install media, you'll probably want a newer one. Go to the Apple Developer Connection to download a newer version (and any updates) after free registration." – Sergey Orshanskiy Oct 24 '13 at 03:19
2

Have you thinked about GNU-Darwin ports? There are many binary packages, gcc too, but i don't tried it on my own.

pts
  • 80,836
  • 20
  • 110
  • 183
1

You'll find an (albeit older) version of Xcode on your Mac OS X install disk.

This won't have the iOS bits, etc. (it will have the Cocos Mac OS X development bits however) , but should be all that you require.

John Parker
  • 54,048
  • 11
  • 129
  • 129
  • 1
    I don't have a install disk. All I have is a Mac with an internet connection, and Mac OS X Leopard running on it. – pts Dec 05 '10 at 17:33
  • I mean on the Mac OS X disk. (It's an optional install.) If that's the case, you don't have much alternative but to go for the full download, as you can't download Xcode on it's own anymore I'm afraid. However, if you only have Leopard (i.e.: not Snow Leopard) Xcode 3.2.5 won't run on your system. As such, you might have to did out your system disk. – John Parker Dec 05 '10 at 17:37
  • That said, if the fink route @Wobble suggests doesn't pan out, try http://connect.apple.com/ - you can get an older standalone version of Xcode 3.1.4 that'll run on your system. (It's a mere 993MB.) – John Parker Dec 05 '10 at 17:44
1

The Xcode download is quite big, but if you really want things to work well, you should use it. I've tried other distributions of GCC on the Mac OS X and I've got so much troubles with them... I could not compile PHP without the GCC Xcode distrib for instance.

pts
  • 80,836
  • 20
  • 110
  • 183
user475434
  • 316
  • 1
  • 1
0

Apple had released the command line tool in Xcode 4.3.2 in late March 2012.

I found the item can be downloaded from AppStore in Mac or the download section of XCode. GCC might be easier to get familier, and Apple version command line tool is fine to me.

Community
  • 1
  • 1
Dennies Chang
  • 564
  • 5
  • 15
  • The question is about OS X 10.5. Xcode 4.3.2 is for OS X 10.7. – Ned Deily May 21 '12 at 18:48
  • I think that Apple release this package is to fix some major app structure of Mac AppStore. Since Mac AppStore force all files of particular app should be saved in the same bundle, the XCode 4.2 and previous edition cannot apply the same logic. Hence, developers will have no way to access the files saved in XCode bundle, and this release become essential. The package was released with XCode 4.3.2. – Dennies Chang May 22 '12 at 08:51