Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I need to install node.js on my new Mac and it requires having c++ or g++ compiler installed. How do I get one without paying for xcode?

share|improve this question
5  
Xcode is a free download for all members of the iOS and Mac Developer Programs. –  Am1rr3zA May 8 '11 at 20:58
9  
It's only XCode 4 that you need to pay for - if you're not a paying developer. XCode 3.2.6 can be downloaded for free. –  Rene Larsen May 8 '11 at 21:32
2  
XCode 4 is less than the price of a latté. –  Ian C. May 8 '11 at 22:10
3  
@Ian C. - Stop shopping at Starbucks, then. –  Fake Name May 9 '11 at 1:56
3  
@Martin: theoatmeal.com/blog/apps :) –  Ian C. May 9 '11 at 13:09
show 2 more comments

6 Answers

up vote 15 down vote accepted

You can still download Xcode 3.x for free with a free developer account. Xcode 3 comes with the GCC 4.2, LLVM-GCC 1.5 and LLVM 1.5 so everything you need to compile C++, C and ObjC code.

(Remark: LLVM 1.5 can't compile C++ code, so you have to switch back to LLVM-GCC or GCC for this.)

share|improve this answer
    
Note that only Xcode 4.1 (I think) on Lion had to be paid for all other versions are free wether from App Store or Developer downloads –  Mark Jan 22 '13 at 10:27
add comment

Just to be complete - Xcode 4.1.1 is free on the App Store but it requires Lion which implies a recent hardware purchase or paying for the upgrade.

share|improve this answer
add comment

OSX GCC Installer

Downloading and installing the massive Xcode installer is a huge hassle if you just want GCC and related tools.

The osx-gcc-installer allows you to install the essential compilers from either pre-built binary packages or helps you create your own installer.

First mentioned here by Dancek

share|improve this answer
add comment

The Mac comes with software DVDs--one of those has Xcode. You can install it from there.

share|improve this answer
3  
This is pretty much the fastest way to get Xcode installed, albeit at the cost of getting a -possibly- outdated version. Since Apple curiously doesn't offer "upgrades", your (also free, as correctly pointed out in JustSid's answer) Xcode 3.x download will be a full 4GB++ package. –  Martín Marconcini May 9 '11 at 8:27
    
For the unknown reason I can see only "Bundled Software" disk in the package and it didn't seem to contain xcode when I've tried to install.. So I've gone with the download solution. Anyways, thanks! –  lyuba May 9 '11 at 21:00
    
This is the best way to bootstrap the latest GCC from open source if you can't or won't get a free Xcode 3 download by enrolling as a free Apple developer. –  bmike Jul 1 '11 at 16:02
add comment

You could get gcc for MacOSX from Apples Open Source site: http://opensource.apple.com/release/developer-tools-40/ It doesn't come with any instructions though.

(I think gcc is suitable, please feel free to correct me if I'm wrong).

share|improve this answer
    
And what exactly is supposed to build GCC without GCC? –  JustSid May 8 '11 at 22:43
3  
@JustSid unicorns, clearly. –  Martín Marconcini May 9 '11 at 8:28
    
@ Martín Marconcini: Ohh, I see. I always wondered why they shipped my iMac with a unicorn, now it makes perfectly sense. –  JustSid May 9 '11 at 9:38
    
Oops, I didn't realise that they don't also provide the binaries for it onthere. –  Samuel Walker May 9 '11 at 11:00
add comment

XCode does NOT come with the latest GCC and G++ (it comes with 4.2), so you still need to do your own install if you want the latest features. Macports and GNU do NOT provide sufficient instructions. So, it remains a mystery.

You can download XCode or find it on your install CD. That will give you you the older GCC/G++. Once you have that, you can download the latest GCC.

US, Tampa: http://mirrors-us.seosue.com/gcc/

BUT, how do you install??

All I know is..

  1. Unzip the folder. It should be named gcc-4.6.3 OR gcc-4.7.3 etc.
  2. Create a new folder ADJACENT to the gcc-4.6.3 folder, called buidgcc (the buildgcc folder and gcc-4.6.3 folder live in the same place. Possibly in the folder Developer/usr )
  3. Open a terminal (Applications->Utilities->Terminal)
  4. Navigate to the buildgcc folder that you created Terminal Commmands cd .. brings you UP 1 level(note space between cd and .. ) ls tells you what files & folders are in the folder you're in cd/foldername lets you navigate into a folder

  5. If you're in the buildgcc folder, type: ../gcc-4.6.3/configure WAIT. Then type: make WAIT a very long time.

Sorry. Here is where I'm stuck.

share|improve this answer
    
Macports does supply instructions on how to install - I have done it often –  Mark Oct 22 '12 at 14:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.