How to fix configure: error: C compiler cannot create executables after pod install on MacOS

Hey everyone.
Recently i decided to get into development of native mobile apps using React Native.
React requires a Ruby gem called Cocoapods, which on it’s side requires GCC (Gnu C Compiler) to compile and install properly.
If the GCC is not configured properly, it will result in the error “configure: error: C compiler cannot create executables”.

To fix this error we will need 3 things:

  • Install XCode
  • Install XCode command tools
  • Configure XCode to use the installed command tools correctly

You can Install XCode by downloading it from the App Store.

Installing the command tools can be done by executing the following command in the terminal

1
xcode-select --install

If you have an old version of the command line tools, you can update them with the following command:

1
2
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

As a last step, you have to open XCode, go to the menu “XCode->Preferences”, the “Locations” tab and choose an item from the dropdown menu near “Command Line Tools”, as shown in this image:

After that you can run “pod install” again and you’ll be greeted with a happy green “Pod installation complete!” message.

C#.NET Development on Windows and MacOS Using Visual Studio Community Edition Are iPhone 7 and iPhone 7 Plus still relevant in 2019 - is it worth buying?

Comments