iosxcodereact-nativemacosxcode-command-line-tools

Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues


i updated os 12.3 to 13.1, xcode 13.1 to 14.1 and installed commandline tools, react native app running through xcode but not running with command line, getting below error

    2022-12-13 16:36:47.584 xcodebuild[3616:20381] Writing error result bundle to /var/folders/zn/6l6295m57kb3vn_8pyn8xtbr0000gn/T/ResultBundle_2022-13-12_16-36-0047.xcresult
xcodebuild: error: SDK "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk" cannot be located.
xcrun: error: Failed to determine realpath of '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk' (errno=No such file or directory)
xcrun: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -find simctl 2> /dev/null' failed with exit code 16384: (null) (errno=No such file or directory)
xcrun: error: unable to find utility "simctl", not a developer tool or in PATH
error Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues.
Error: Command failed: xcrun simctl list --json devices
2022-12-13 16:36:47.584 xcodebuild[3616:20381] Writing error result bundle to /var/folders/zn/6l6295m57kb3vn_8pyn8xtbr0000gn/T/ResultBundle_2022-13-12_16-36-0047.xcresult
xcodebuild: error: SDK "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk" cannot be located.
xcrun: error: Failed to determine realpath of '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk' (errno=No such file or directory)
xcrun: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -find simctl 2> /dev/null' failed with exit code 16384: (null) (errno=No such file or directory)
xcrun: error: unable to find utility "simctl", not a developer tool or in PATH

    at checkExecSyncError (node:child_process:828:11)
    at Object.execFileSync (node:child_process:863:15)

but react native app running fine if run this command export SDKROOT=$(xcrun -sdk macosx --show-sdk-path) before running react-native run-ios, if i close the terminal and run again the react native app it is showing same error again

i tried these steps

sudo xcode-select --reset
sudo xcode-select --install

Solution

  • Hi i finally found the issue, my .zshrc file pointing to older sdk, i removed SDKROOT path in .zshrc file and did run export SDKROOT=$(xcrun -sdk macosx --show-sdk-path) in terminal, issue resolved for me

    enter image description here