pod install or a React Native iOS build says the iphoneos SDK cannot be located
xcrun: error: SDK "iphoneos" cannot be locatedShort answer
The iphoneos SDK ships inside Xcode, not in the small Command Line Tools package. If xcode-select points at /Library/Developer/CommandLineTools, or a DEVELOPER_DIR variable points there, xcrun finds no iOS SDK. Print the active path with xcode-select -p and switch it to your Xcode.app.
Fix it fast
1Find out which cause you have
Print the folder xcode-select is using, and any DEVELOPER_DIR override in the current shell. The two answers decide which cause below applies.
xcode-select -p echo "DEVELOPER_DIR=$DEVELOPER_DIR"2Match what you see, then jump to its fix
What does the error look like?
xcrun: error: SDK "iphoneos" cannot be located
Cause 1 of 2
xcode-select points at the Command Line Tools instead of Xcode
1Check
Apple describes the Command Line Tools package as a small separate download that holds the macOS SDK and tools such as Clang. It is not a full Xcode, so there is no iOS SDK in it. Check that a full Xcode is installed and which folder is selected.
xcode-select -p
ls -d /Applications/Xcode*.app2Fix
Switch the active developer folder to your Xcode. The command needs an administrator password and applies to every user of the Mac. The same switch is available in Xcode under Settings, Locations, Command Line Tools.
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer3Verify
The printed path now ends in Xcode.app/Contents/Developer. Run the failing step again, for example pod install in the ios folder.
xcode-select -p
cd ios && pod installConfirmed by developer.apple.com
Cause 2 of 2
A DEVELOPER_DIR variable overrides the selection
1Check
The xcode-select man page says DEVELOPER_DIR overrides the system-wide active developer directory. A line in ~/.zshrc, a CI job setting or an old shell can keep pointing it at the Command Line Tools.
echo "$DEVELOPER_DIR"
grep -n DEVELOPER_DIR ~/.zshrc ~/.zprofile ~/.zshenv 2>/dev/null2Fix
Remove the variable, or point it at the Xcode developer folder. DEVELOPER_DIR accepts either the Developer folder or the Xcode.app folder.
unset DEVELOPER_DIR
# or, for this terminal only:
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer3Verify
Open a new terminal tab, print the variable and run the step that failed.
echo "DEVELOPER_DIR=$DEVELOPER_DIR"
cd ios && pod installConfirmed by keith.github.io
How do I stop it coming back?
- After installing or renaming Xcode, run xcode-select -p once and make sure it ends in Xcode.app/Contents/Developer.
- Install the Command Line Tools through Xcode settings and keep Xcode as the selected folder.
- Do not export DEVELOPER_DIR in shell profiles; set it per job in CI instead.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Mobile apps
git, clang or xcrun stops working because the active developer folder is gone
xcrun: error: invalid active developer path (/Applications/Xcode.app/Contents/Developer), missing xcrun at: /Applications/Xcode.app/Contents/Developer/usr/bin/xcrun
The folder that xcode-select points to no longer holds developer tools, so xcrun, git, clang and make cannot start.
3 causes, each with a fixMobile apps
Running pod on a React Native project fails with can't find gem cocoapods
can't find gem cocoapods (>= 0.a) with executable pod
The pod command exists, but the Ruby that is running it has no CocoaPods gem.
3 causes, each with a fixMobile apps
Axios request works on iOS or in a browser but fails on Android with Network Error
AxiosError: Network Error
A React Native app has no CORS, so on Android a Network Error usually means the request never reached the server.
3 causes, each with a fixMobile apps
Axios returns Network Error in a React Native app on iPhone or the iOS Simulator
error.code is ERR_NETWORK and error.response is undefined
A Network Error means iOS stopped the request before any HTTP answer came back.
3 causes, each with a fixMobile apps
backgroundImage: url(...) does nothing in a React Native view
ImageBackground renders an empty area
In React Native the backgroundImage style draws linear and radial gradients, not pictures, so url(...) is ignored.
3 causes, each with a fixMobile apps
A custom font in React Native falls back to the system font
Unrecognized font family 'MyFont'
React Native does not report a missing font, it just draws the system font.
6 causes, each with a fix