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
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
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.