If you encounter this issue when trying install/update your Pods and build your React Native iOS app, here is the solution:

Open the Terminal and enter:

sudo xcode-select --switch /Applications/Xcode.app

If your Xcode app is not located in the /Applications directory - replace it with its correct location.

Happy coding! 👻

Credits to @scttmthsn who shared the solution in a react-native repo's open issue! 🙇‍♂️