You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Developer Forums relocated!

Need help with Apple Developer tools and technologies? Want to share information with other developers and Apple engineers? Visit Developer Forums at Apple.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

On Big Sur, can't install a C++ compiler

Hi,


I have an old MacBook Pro that run macOS 11.7.10 and want to follow a C++ course from LinkedIn. Tried to install XCode but was told it is not supported on Big Sur. So I tried to install gcc following instructions from Install GCC on MacOS - YouTube This is not successful. Homebrew is installed, but when I run "brew install gcc", the process freezes here:


==> Applying gcc-xcode15-warnings.diff
patching file gcc/config/aarch64/darwin.h
patching file libgfortran/libgfortran.spec.in
==> ../configure --prefix=/usr/local/opt/gcc --libdir=/usr/local/opt/gcc/lib/gcc
==> make


Can some one help me solve this issue ? Or is there some way to install clang without install installing the fulll XCode ?


Many thanks

MacBook Pro 15″, macOS 11.7

Posted on Feb 5, 2024 8:42 AM

Reply

Similar questions

10 replies

Feb 5, 2024 9:26 AM in response to Planteg

As far as I know, homebrew itself requires a compiler. I think it either requires the Command Line tools or it installs them itself. But one thing Homebrew always does is corrupt command line environments, which it has most certainly done in your case.


You will have to uninstall homebrew on your own. Good luck with that.


Assuming that your system wasn't already corrupted, you could just attempt to run the "clang" compiler and that would automatically install the Command Line tools. You may also be able to install the full version of Xcode 13.2.1, available here: https://developer.apple.com/download/all/?q=xcode


You may need to create a free developer account. I don't know if you will be able to access the downloads or not.

Feb 11, 2024 4:10 PM in response to Planteg

You’ll need to continue to discuss untangling this Apple ID with Apple.


Or create a new Apple ID, migrate to that, and use Family Sharing until you’ve offloaded your data from the problematic Apple ID. Untangling this is akin to unsharing an Apple ID: How to “unshare” an Apple ID - Apple Community


I’d suspect there’ll continue to be issues with this Apple ID, otherwise.

Feb 5, 2024 9:45 AM in response to Planteg

The build of GCC will take a long time on an older Intel Mac with no apparent progress from the make command. I did this just once several years ago and decided to just use Apple's command line tools for Xcode instead. Takes less than five minutes to install versus an hour build of GCC.


I recommend that you just install Apple's command line tools for Xcode. It has a modern C++ compiler in Clang++ and support for C++ standards through ISO C++ 2023. A prerequisite of homebrew is that it will detect, and if missing, install the command line tools for Xcode on the first package install command, so you may already have it.


Alternatively:


xcode-select --install


Then to see supported C++ standards, enter an invalid character for the standard to get a list:


clang++ foo.C --std=x


and help for clang++:


clang++ --help | more



And to remove the entire homebrew installation:


https://github.com/homebrew/install#uninstall-homebrew

Feb 5, 2024 10:59 AM in response to Planteg

Some more information


Using instruction from Installing LLVM/Clang on OS X - Embedded Artistry I tried installing LLVV/Clang and again the script hangs with make:


==> Installing dependencies for llvm: cmake, ninja, pcre2, swig, mpdecimal, ca-certificates, openssl@3, readline, sqlite, pkg-config, python@3.12 and z3

==> Installing llvm dependency: cmake

==> ./bootstrap --prefix=/usr/local/Cellar/cmake/3.28.2 --no-system-libs --paral

==> make


Is there a log somewhere I can have a look at ?


Thanks again

Feb 5, 2024 11:09 AM in response to Planteg

Now, you are beginning to see the dependencies in using homebrew. No one in this thread recommended that you dig a deeper hole by using homebrew to install llvm. It was recommended to just install from Apple, the command line tools for Xcode and you would have what you need to compile C++ software — without the homebrew quagmire.

Feb 5, 2024 12:04 PM in response to Planteg

Planteg wrote:

Some more information

Using instruction from Installing LLVM/Clang on OS X - Embedded Artistry I tried installing LLVV/Clang and again the script hangs with make:

==> Installing dependencies for llvm: cmake, ninja, pcre2, swig, mpdecimal, ca-certificates, openssl@3, readline, sqlite, pkg-config, python@3.12 and z3
==> Installing llvm dependency: cmake
==> ./bootstrap --prefix=/usr/local/Cellar/cmake/3.28.2 --no-system-libs --paral
==> make

Is there a log somewhere I can have a look at ?

Thanks again


First, if some C++ course is sending you after this build-the-toolchain rock-fetch, do yourself an immense favor and find yourself a different (better) course. Both gcc and llvm/clang are immense builds. Complex builds, too.


I would strongly encourage you to sign up for a (free) Apple developer account and use that to download an older version of Xcode for Big Sur (Xcode 13.2.1 is the newest that still runs on macOS 11.3 and later) if you can’t upgrade your Mac, or you will want to install and use the command-line tools as was listed above:


xcode-select --install


I’d suspect most classes won’t be teaching Xcode. They’ll probably be using some text editor and the command-line tools, which works but is right out of Y2K-era and earlier development practices. Xcode is much more to learn beyond C++ itself, but it’ll also help with source code development and source code management.

Feb 6, 2024 5:15 PM in response to Planteg

@etresoft


But one thing Homebrew always does is corrupt command line environments, which it has most certainly done in your case.


That seems to be the case, now I know!


You will have to uninstall homebrew on your own. Good luck with that.


I confirm that was a nightmare. Maybe because of Big Sure, but Homebrew is not a good quality tool. Continue reading...


@VikingOSX


And to remove the entire homebrew installation:


Even that failed. The scripts are not fault tolerant: should an issue happen, the script just stop, errors are not managed. And when the script stops, it has already done some job, but you are not told what. Starting the script again brings new issues. I had to delete myself the leftovers. The scripts do not manage errors, pity.


I will never drink that beer again!


@Keith Barkley,


If you get a free developer account, you can download older versions of XCode that will work with your machine.


This is the net step, I will try to install command line tools for Xcode solely, that will be enough since I will use VisualCode as the IDE.


Thanks to all




Feb 7, 2024 9:14 AM in response to Planteg

@VikingOSX


And to remove the entire homebrew installation:


Even that failed. The scripts are not fault tolerant: should an issue happen, the script just stop, errors are not managed. And when the script stops, it has already done some job, but you are not told what. Starting the script again brings new issues. I had to delete myself the leftovers. The scripts do not manage errors, pity.

---

I have used that same homebrew removal script on several occasions without failure, because after a period of time, I want to eliminate the dependency creep (ok bloat) with package updates and just start over with fewer package choices.

Feb 11, 2024 3:32 PM in response to Keith Barkley

Hello @Keith Barkley,


I tried to create a (free) developer account on Apple Developer, but to my great surprise I discovered that I am already linked to another Developer account. Way back many years ago I worked with a business that had a Developer account and I (my Apple ID) was linked with that Enterprise ID.


So I asked that guy to detach me from his business account, but that's when the trouble came in: he did not pay the renewal for his Developer account in 2017, and he can't manage his account unless he pays again ! He is not interested because he does not develop for Apple products anymore. Do you know how I can solve this problem ?


Visual Studio Code is also a pain: I have some extensions installed from Microsoft, but one of these relies on CMake, an extension that was abandoned in 2017. When I try to compile, C/C++ runner is invoked, as well as brew, even though both have uninstalled. And I discovered that I don't have a TimeMachine backup, stupid me !

On Big Sur, can't install a C++ compiler

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.