question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Description

Hello, after downloading the xcode 13 I get an error when running react-native -run-ios --device "my device" the error: error Command failed: xcrun instruments -s xcrun: error: Failed to locate 'instruments'. xcrun: error: unable to find utility "instruments", not a developer tool or in PATH

React Native version:

IDEs: Android Studio: 3.5 AI-191.8026.42.35.6010548 Xcode: 13.0/13A233 - /usr/bin/xcodebuild Languages: Java: 1.8.0_242 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 16.8.6 => 16.8.6 react-native: 0.59.0 => 0.59.0 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found Capture d’écran 2021-10-04 à 18 44 10

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

5reactions
aimensasicommented, Oct 5, 2021

The same issue here cannot run on the device, after updating Xcode.

Did you find a solution?

3reactions
jthiardcommented, Nov 4, 2021

For those not willing to upgrade, here is the patch I applied with patch-package. XCode@13.1, react-native@0.61.5 and @react-native-community/cli-platform-ios@3.2.0

file : patches/@react-native-community+cli-platform-ios+3.2.0.patch

diff --git a/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js b/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js
index 0df6b73..49f255f 100644
--- a/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js
+++ b/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js
@@ -49,6 +49,8 @@ var _findXcodeProject = _interopRequireDefault(require("./findXcodeProject"));
 
 var _parseIOSDevicesList = _interopRequireDefault(require("./parseIOSDevicesList"));
 
+var _parseXctraceIOSDevicesList = _interopRequireDefault(require("./parseXctraceIOSDevicesList"));
+
 var _findMatchingSimulator = _interopRequireDefault(require("./findMatchingSimulator"));
 
 var _warnAboutManuallyLinkedLibs = _interopRequireDefault(require("../../link/warnAboutManuallyLinkedLibs"));
@@ -100,7 +102,7 @@ function runIOS(_, ctx, args) {
     return runOnSimulator(xcodeProject, scheme, args);
   }
 
-  const devices = (0, _parseIOSDevicesList.default)(_child_process().default.execFileSync('xcrun', ['instruments', '-s'], {
+  const devices = (0, _parseXctraceIOSDevicesList.default)(_child_process().default.execFileSync('xcrun', ['xctrace', 'list', 'devices'], {
     encoding: 'utf8'
   }));
 
diff --git a/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/parseXctraceIOSDevicesList.js b/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/parseXctraceIOSDevicesList.js
new file mode 100644
index 0000000..0c45209
--- /dev/null
+++ b/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/parseXctraceIOSDevicesList.js
@@ -0,0 +1,70 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+  value: true
+});
+exports.default = void 0;
+
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ */
+
+/**
+ * Parses the output of the `xcrun instruments -s` command and returns metadata
+ * about available iOS simulators and physical devices, as well as host Mac for
+ * Catalyst purposes.
+ *
+ * Expected text looks roughly like this:
+ *
+ * ```
+ * == Devices ==
+ * this-mac-device [UDID]
+ * A Physical Device (OS Version) (UDID)
+ *
+ * == Simulators ==
+ * A Simulator Device (OS Version) (UDID)
+ * ```
+ */
+function parseIOSDevicesList(text) {
+  const devices = [];
+  let isSimulator = false;
+
+  if (text.indexOf('== Simulators ==') === -1) {
+    return [];
+  }
+
+  text.split('\n').forEach(line => {
+    if (line === '== Simulators ==') {
+      isSimulator = true;
+    }
+
+    const device = line.match(/(.*?) (\(([0-9.]+)\) )?\(([0-9A-F-]+)\)/i);
+
+    if (device) {
+      const [, name,, version, udid] = device;
+      const metadata = {
+        name,
+        udid
+      };
+
+      if (version) {
+        metadata.version = version;
+        metadata.type = isSimulator ? 'simulator' : 'device';
+      } else {
+        metadata.type = 'catalyst';
+      }
+
+      devices.push(metadata);
+    }
+  });
+  return devices;
+}
+
+var _default = parseIOSDevicesList;
+exports.default = _default;

I still have some warnings but running on device seems to work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Running React Native App From Terminal (iOS)
Found Xcode project TestProject.xcodeproj xcrun: error: unable to find utility "instruments", not a developer tool or in PATH Command failed: xcrun ...
Read more >
Xcrun instruments not found xcode … | Apple Developer Forums
An error occurred: Command failed: xcrun instruments -s ✖ xcrun: error: unable to find utility "instruments", not a developer tool or in PATH....
Read more >
How To Fix - "Error: Unable To Find Utility "Instruments", Not A ...
In this post, we will see How To Fix - "Error: Unable To Find Utility "Instruments", Not A Developer Tool or In PATH"....
Read more >
Cannot Run RN 0.59 CLI's 'run-ios' on xCode 13 #1474 - GitHub
... unable to find utility "instruments", not a developer tool or in PATH error Command failed: xcrun instruments -s xcrun: error: Failed to ......
Read more >
error: unable to find utility "instruments", not a developer tool ...
Support the stream: https://streamlabs.com/svmathtutorThis video shows how to fix this error: xcrun : error : unable to find utility ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found