375

I have Xcode 6.2 Beta. Attempting

xcrun simctl 

in terminal yields

xcrun: error: unable to find utility "simctl", not a developer tool or in PATH

3
  • 2
    My app was running without issue then suddenly I came across this. I had no license to agree to and command line tools was set. A simple reboot of my machine worked.
    – StoriKnow
    Commented Nov 27, 2020 at 18:33
  • please select correct answer
    – patataskr
    Commented Mar 25, 2022 at 12:27
  • After adding a second user to my Mac, I ran into this issue. This command resolved it!
    – Julian K
    Commented Dec 13, 2022 at 18:14

13 Answers 13

893

I solved this problem by entering

Xcode > Preferences > Locations 

And assigning the Command Line Tools

This is in Xcode Version 7.2 beta (7C46t) enter image description here

8
  • 23
    "assigning the Common Line Tools" ... nice, but why aren't they set on install? haha Commented Oct 3, 2018 at 18:05
  • 1
    Great! After updating to Catlina 10.15.3 it simply disappeared.
    – kmnowak
    Commented Feb 1, 2020 at 15:56
  • Note this also works when "pod lib lint My.podspec" throws the same error. Commented Apr 6, 2021 at 17:21
  • I also got this error after installing brew. This answer works like a charm, thanks! Commented May 5, 2021 at 15:12
  • 1
    Worked for Xcode 14 as well. They need to set it on install.
    – Qazi Ammar
    Commented Oct 6, 2022 at 7:32
135

In Xcode, open the Xcode menu at the top, then select Preferences…, and then select the Locations tab.

Xcode screenshot

2
  • 3
    This makes it a lot more clear how to make the change, thanks for pic!
    – Jose
    Commented Nov 3, 2019 at 18:43
  • Just clicking the dropdown causes the machine to ask for a password and fixed the issue. Commented Mar 9, 2023 at 15:45
113

In Terminal, try this.

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

/Applications/Xcode.app is your Xcode.app path.

If you still get an error in the terminal.

try sudo xcodebuild -license to agree to the license.

2
  • This is what worked for me. I always had Xcode installed and always worked in the IDE, but this is the first time that I am using Xamarin in VS for Mac. Once I issued the second command in the terminal and started the debugger, the "Deploying to Device" window showed that I accepted the license and then started installing additional components.
    – Janou
    Commented Nov 13, 2022 at 16:49
  • This answer should have way more visibility. According to how you installed xcodebuild you could not have licenses accepted, things don't work and you don't know why Commented Oct 27, 2023 at 8:56
96

Got similar issue on executing command

./Scripts/bootstrap.sh -d.

This helped me Xcode > Preferences > Locations, Set Command line Tools

enter image description here

3
  • How classic issue..
    – Renetik
    Commented Jun 1, 2022 at 2:24
  • Weird, but works! Thanks for all the help man, I don't know what I'd do building iOS stuff without this kind of help! Commented Aug 10, 2023 at 14:50
  • Yeap, That's it... Commented Dec 14, 2023 at 0:55
13

I had the same problem. My application was working well but suddenly in next run, it started throwing the "simctl" error. It seems I had started Xcode update installation in the background.

Fix: I just started the Xcode application and it prompted to install some pending tools update. After Xcode updates, my app started working normally.

11

Had this issue after the latest version of XCode (Version 14.0 (14A309)) installed itself.

For me the Command Lint Tools were all installed etc and it made no sense; none of the above worked. However when running xcrun -v simctl it showed me that my SDKPATH was set to version 15.5 of the SDK; the new version is 16.0.

To resolve I added the below line to the top of my .zshrc file and restarted my terminal.

export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk

Note: The 'file' iPhoneSimulator.sdk is a simlink to the latest SDK version so I hope I don't need to change this again!

2
  • it works also for minor version 14.3 (14E222b)
    – Jonathan
    Commented May 11, 2023 at 8:39
  • 1
    So my issue here is that I apparently defined SDKROOT in my .zshrc. Simply removing the export SDKROOT was enough to allow the properly-selected Command Line Tools selection to work.
    – Justin N
    Commented Jul 12, 2023 at 17:41
8

While running Xcode, open the Xcode menu, go to Preferences…, then select Locations

In Locations, "Command Line Tools", choose your version of Xcode.

It should be fine. This worked for me.

7

Choose Xcode Preferences then choose Locations tab and inside go to command line tools Drop down box and choose one.

Problem sovled !

FYI: I tried this with Xcode 12.3

2
  • Worked for 13.3.1. Thanks!
    – jbrahy
    Commented Nov 18, 2022 at 22:57
  • Also worked for Xcode 14.2 Commented Mar 29, 2023 at 10:32
2

If you are interested in command line "approach", please try: installer -pkg /Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg -target /. In addition, please make sure that xcode-select -s selected right Xcode installation path.

2

adding xcode in preference-> locations works fine

1
  • 2
    Adding command line tools as xcode version in preference-> locations works fine
    – Anshu
    Commented Jan 2, 2020 at 0:06
2

You are facing this issue because the path of command line tools are not configured correctly in your XCode. Please navigate to Xcode > Settings > Locations tab . Unselect and select the XCode version name option and that should resolve this issue.

enter image description here

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jan 19 at 14:38
-1

Here are a few steps you can try to fix this error,

1.) Clean and Rebuild Solution: Clean the solution in Visual Studio by going to the "Build" menu and selecting "Clean All" or using the keyboard shortcut Shift + Command + K. After that, rebuild the solution by selecting "Build All" from the "Build" menu or using the keyboard shortcut Command + B.

2.) Verify Build Configuration: Make sure you have the correct build configuration selected. Go to the toolbar at the top of Visual Studio and check the selected build configuration (e.g., Debug, Release). Ensure that you're trying to launch the application with the appropriate build configuration.

3.) Check Provisioning Profiles: Ensure that the provisioning profiles used for the app are correctly configured. Make sure you have valid provisioning profiles for the device or simulator you're trying to run the app on. You can check and manage your provisioning profiles in Xcode's "Preferences" under "Accounts" and ensure they are up to date.

4.) Restart Visual Studio and Simulator: Quit Visual Studio for Mac and close the iOS Simulator. Then, relaunch Visual Studio and the Simulator to see if the issue persists.

5.) Update Xcode and iOS Simulator: Make sure you have the latest version of Xcode and the iOS Simulator installed. Open the App Store on your Mac, go to the Updates tab, and install any available updates for Xcode or the iOS Simulator.

-2

following are the steps to solve this issue -

  1. open terminal on your mac
  2. type cd.. 2 times
  3. Now go to /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
  4. Now type ls, you will find sdk's here. Fir iPhone, you should see iPhoneOS.sdk.
  5. copy this path as /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
  6. now reopen the terminal and type export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
  7. now this error should be removed and your devices should be now recognised by system

Not the answer you're looking for? Browse other questions tagged or ask your own question.