356

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

alexander.sivak
  • 4,352
  • 3
  • 18
  • 27

12 Answers12

867

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

skywinder
  • 21,291
  • 15
  • 93
  • 123
fbozo
  • 8,791
  • 1
  • 13
  • 8
  • 19
    "assigning the Common Line Tools" ... nice, but why aren't they set on install? haha – Chris Allinson Oct 03 '18 at 18:05
  • 1
    Great! After updating to Catlina 10.15.3 it simply disappeared. – kmnowak Feb 01 '20 at 15:56
  • Note this also works when "pod lib lint My.podspec" throws the same error. – The Camster Apr 06 '21 at 17:21
  • I also got this error after installing brew. This answer works like a charm, thanks! – Jeaf Gilbert May 05 '21 at 15:12
  • If my Xcode have the above path setup. Shall i need the download the command line tools additionally in the machine – sejn Dec 07 '21 at 10:37
  • 1
    Worked for Xcode 14 as well. They need to set it on install. – Qazi Ammar Oct 06 '22 at 07:32
  • In case somebody like me stuck in the obvious image. After enter the `Locations` Tabs, you should select the `Command Line Tools` to an options and the comment below will change to your Xcode path. And then back to a new terminal, `simctl` is ready to go. – djzhu Jul 16 '23 at 14:25
128

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

Xcode screenshot

shim
  • 9,289
  • 12
  • 69
  • 108
coders
  • 2,287
  • 1
  • 12
  • 20
90

Got similar issue on executing command

./Scripts/bootstrap.sh -d.

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

enter image description here

Gulshan Nadaph
  • 1,011
  • 7
  • 5
89

In Terminal, try this.

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

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

if U still get error in terminal.

try sudo xcodebuild -license to agree license.

leonardosccd
  • 1,503
  • 11
  • 12
  • 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 Nov 13 '22 at 16:49
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.

jsr
  • 181
  • 1
  • 5
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.

shim
  • 9,289
  • 12
  • 69
  • 108
Rawand Saeed
  • 795
  • 10
  • 13
7

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!

Gavin Harris
  • 652
  • 5
  • 15
  • it works also for minor version 14.3 (14E222b) – Jonathan May 11 '23 at 08: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 Jul 12 '23 at 17:41
6

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

Amogam
  • 321
  • 5
  • 20
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.

Serzas
  • 1,016
  • 8
  • 8
2

adding xcode in preference-> locations works fine

Anshu
  • 35
  • 4
0

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.

Rahul Bansal
  • 1,382
  • 15
  • 22
-1

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