How do I install g++ on MacOS X?

前端 未结 5 1240
臣服心动
臣服心动 2020-12-09 16:15

I want to compile C++ code on MacOS X, using the g++ compiler. How do I install it?

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-09 16:50

    Installing XCode requires:

    • Enrolling on the Apple website (not fun)
    • Downloading a 4.7G installer

    To install g++ *WITHOUT* having to download the MASSIVE 4.7G xCode install, try this package:

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

    The DMG files linked on that page are ~270M and much quicker to install. This was perfect for me, getting homebrew up and running with a minimum of hassle.

    The github project itself is basically a script that repackages just the critical chunks of xCode for distribution. In order to run that script and build the DMG files, you'd need to already have an XCode install, which would kind of defeat the point, so the pre-built DMG files are hosted on the project page.

提交回复
热议问题