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

xcode-select --install

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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.