Mac – XCode – SDK “iphoneos” cannot be located – how to fix How to fix the SDK "iphoneos" cannot be located error when working on XCode using MacOS

Mac - XCode - SDK "iphoneos" cannot be located - how to fix

If you’ve stumbled upon this post, it most likely means that you’re getting this error:

SDK “iphoneos” cannot be located

when trying to run a pod install or perform similar command-line tasks from a Mac terminal while working on a XCode project.

This is a typical scenario when you update a lot of stuff together – such as XCode and CocoaPods.

The fix

Luckily enough, the fix is very simple: open a new terminal window and type the following command:

If XCode is installed, you should see a wrong installation path, such as /Library/Developer/ or something like that: it’s very likely that your XCode installation is located somewhere else – such as in the /Applications/ folder. If that’s so, you can fix your issue by typing the following command:

If the xcode-select command return a “not found” error, it most likely means that XCode is not installed: just install it and try again.

Alternate method using the XCode GUI

If you don’t want to use the macOS terminal, you can perform the same tasks using the XCode GUI in the following way:

  • Open XCode (you need to have it installed)
  • From the main menu, select Preferences
  • Open the Locations tab
  • Make sure that the Command Line Tools parameter has an entry: if not, click on the dropdown and select one (preferably the latest version).
  • Save

Many thanks to @Martin for suggesting this (see the Comments sections of this post)!

 

About Ryan

IT Project Manager, Web Interface Architect and Lead Developer for many high-traffic web sites & services hosted in Italy and Europe. Since 2010 it's also a lead designer for many App and games for Android, iOS and Windows Phone mobile devices for a number of italian companies. Microsoft MVP for Development Technologies since 2018.

View all posts by Ryan

7 Comments on “Mac – XCode – SDK “iphoneos” cannot be located – how to fix How to fix the SDK "iphoneos" cannot be located error when working on XCode using MacOS

  1. Thanks, great explanation. In my case Xcode was basically extracted to ~/Downloads. So, the fix was to run: sudo mv ~/Downloads/Xcode.app /Applications/

  2. I usually don’t leave any comment, but you tell the exact reason and how to fix it nicely and save my time. thanks

  3. The easiest way to do this without path guess work:
    – make sure Xcode is installed
    – open Xcode
    – open Preferences menu
    – open Locations tab
    – make sure “Command Line Tools” has an entry. If not, click on the dropdown and select one (preferably the latest version).
    – save.

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.