✖ Error running xcrun simctl and ValueError: No JSON object could be decoded on Mac 12.2.1

Mac OS: 12.2.1 Monterey
Appium. 1.22.0 (on appium GUI server) and appium 1.22.2 on terminal.
XCode 13.3.1
JDK 1.8.0_322
Carthage 0.38.0
Node17.8.0
Npm 8.5.5
Appium-doctor1.16.0
Homebrew 3.4.5

When I run the “appium-doctor --ios”, I get the error "Error running xcrun simctl "
When I try to build inside XCode, I get the error “/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgentLib/Routing/FBWebServer.m:12:9: ‘RoutingHTTPServer/RoutingConnection.h’ file not found

BTW, my WebDriverAgent.xcodeproj project is under a different folder:
/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent and as well as under the folder
/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent

I am new to appium, that is mobile testing. Please help !

This makes me think you may not have Xcode command line tools, can you check?

1 Like

Yes, I followed these steps to include the XCode command line tools.
xcode-select --install

When I run the command again, I am getting a response that the command line tools were already installed. So, confirmed.

This is ok, as you’ve installed both Appium Server (GUI) and it looks like the NPM install. I’m guessing you’ve installed appium-doctor through NPM as well, but not sure.

Did you run:

./Scripts/bootstrap.sh

As referenced here:

Also, see here:

https://github.com/appium/appium-desktop/issues/159

Yes, I did run the commands
*** mkdir -p Resources/WebDriverAgent.bundle**
*** ./Scripts/bootstrap.sh -d**

$ appium-webdriveragent % ./Scripts/bootstrap.sh -d
Fetching dependencies
xcrun: error: unable to find utility “simctl”, not a developer tool or in PATH
Traceback (most recent call last):
File “”, line 1, in
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py”, line 291, in load
**kw)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py”, line 339, in loads
return _default_decoder.decode(s)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py”, line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py”, line 382, in raw_decode
raise ValueError(“No JSON object could be decoded”)
ValueError: No JSON object could be decoded

Something is wrong with the Xcode command line utilities. Try this:

Rebooting the Mac at some point is not a bad idea either. Maybe that will set the path correctly.

1 Like

Mr. @wreed
Appreciate your patiently trying to help me.
Yes, I did choose the Xcode.app path “/Applications/Xcode.app” in the XCode.app v. 13.3.1 preferences and tried to re build the WebDriverAgent.xcodeproj project. Plus I clean the project, reboot the mac and rebuilt the project, but no avail and the project build failed.

But I tried the following two steps with in the WebDriverAgent.xcodeproj folder again, just incase:

  • mkdir -p Resources/WebDriverAgent.bundle
  • ./Scripts/bootstrap.sh
    and also ran
    appium-doctor --ios
    All the commands executed with out any previously mentioned error messages.
    Nevertheless, the WebDriverAgent project build in Xcode still failing. with the message
    ’RoutingHTTPServer/RoutingConnection.h’ file not found
    image

Ok, so there seems to be progress.

I know you have 2 installs, you are taking these actions on only one of them, correct? Or did you try on both and get the same failures?

I did find an old bug with the same issue. There are a few ideas we haven’t tried though:

Mr @wreed;
Yes, there seems to be some progress.
One is from running the command ‘appium-doctor --ios’ output which shows only optional dependencies have to be fixed…an improvement from the past.See below picture.

Yes, Out of the two installs, I am using both in the terminal and with in the XCode, the one WebDriverAgent.xcodeproj from Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent
as the original expected path
/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/WebDriverAgent was not available.

As you mentioned, the old bug with the same issue “*RoutingHTTPServer/RoutingConnection.h' file not found*” was not solved there in the thread. The suggestion by dpgraham on Apr,12th 2018to run ./Scripts/bootstrap.sh and ./Scripts/build.sh DID NOT YIELD ANY POSITIVE RESULTS.
I am still getting the same 2 error messages as like earlier in the XCode tool, disregarding warnings
image

This is very close to what he suggests, what he really said was:

Can you try navigating to: /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/ and running ./Script/bootstrap.sh -d and post the output.

I believe that the -d option is the debug option, so that we can see what is going on. The output of that might be really useful.

It’s also unclear what fixed the problem. I had hoped you would read it through and try edrum’s suggestion:

  1. brew uninstall carthage
  2. brew install carthage
  3. brew link --overwrite carthage
  4. restart & try

My belief is that when you have a problem you can’t solve, try everything suggested. Sometimes the thing you are sure is not the problem is really the fix.

Good Luck!

@wreed
Sorry, for not being able to communicate well.
In my very first posting, I was pointing out that the folder structure is different in my appium. 1.22 version installation (both appium GUI, and appium through npm).
My WebDriverAgent.xcodeproj is existing with in

and
/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/
folders respectively for Appium GUI and Appium via node.js installations.

The suggested folder
/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/ exists upto
/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/ folder only

The possibility of invoking commands

  • mkdir -p Resources/WebDriverAgent.bundle
  • ./Scripts/bootstrap.sh -d

does exist only for Appium GUI server installation location only, as /Scripts/bootstrap.sh file does not exist for node.js installation at /usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/Scripts folder

Again, I ran the brew commands as per @edrum’s suggestion

  1. brew uninstall carthage
  2. brew install carthage
  3. brew link --overwrite carthage
  4. restart & try

I pointed my XCode project at the Appium Gui installation location at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/, but I still got the same result.
image

My sincere apologies, for not being able to follow the help correctly. This is my first time, setting up Appium for testing iOS devices on Mac OS(Monterey v. 12.2.1). And I did not expected this much deviation from the documented help.

1 Like

Ok, so first, you don’t owe me any apologies. I am trying to help you, but you need to understand that I cannot see what you are seeing, I do not know how you set up the machine, or if someone else set it up, etc. My method towards helping people on this board is along the lines of “teaching someone to fish” rather than “giving a fish” if you know what I mean. I can only help you to help yourself.

That said, you have had an inordinate amount of setup issues

You should use more open source software! It’s an adventure! But in doing so you have to take on a lot of responsibility that you wouldn’t with closed source (paid).

At this point I’m thinking that there must be something wrong with your Xcode setup. Here is the Github page for WebDriverAgent:

You will see at the bottom that they have now included RoutingHTTPServer in the source code. I think those old scripts used to download it, sorry I hadn’t seen that change. Take a look in WebDriverAgent/WebDriverAgentLib/Vendor/RoutingHTTPServer and see if the source is there. If it is there, why can’t Xcode find it? Do you work with Developers? If so you may ask one of them what’s going on here. I feel that you should get some hands on help if you can. If you don’t work with developers, and can’t get any hands on help, then let me know and we will continue.

Mr. @wreed;
This is my first time trying to use appium that too setting up for iOS devices. I am sure, what you said about XCode is right that “there must be some thing wrong with your XCode setup”. I and another senior colleague downloaded from our Employer’s self service location. Would you advice downloading from the web ? There is no restrictions ! What I am confused about is my senior colleague has moved forward troubleshooting this problem for two days, as he had some mileage with the tool and the technology. He is very busing doing POCs. We have no access to Dev team and they are super busy too. I am on my own here.

First Question: I understand that I installed appium in two(appium GUI server and appium using node.js) places at

  • /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent

  • /usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent

I believe installing appium server GUI version is better than npm version. This is my guess.

Since the location
/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent does not exist in my installation, it is 100% problem with the installation. I think I can un install this with

npm uninstall -g appium

reinstall it using npm install -g appium and then see if the project can be loaded in to the XCode and built successfully.

Is this the right approach ?

It’s not a bad approach. Personally, I think the NPM version should be better, but I’m also a bit of a pragmatist and will go with whatever is currently working.

Did you find the RoutingHTTPServer files? You should be able to see them in Xcode in the path I gave above. Check that they are visible but that Xcode is having this weird error before you start uninstalling things…

@wreed
Suddenly when I restart my XCode app, it started to build the project successfully. I don’t remember, what I have done to make it work apart from the stuff, you were advising me.
Anyways, it has been a great help.
This is the kind of help, which is helping a newbie to get on his path of progressing on the tool, goes a long way in making the newbie in to an experienced professional. I am indebted to you @wreed.
Much appreciated.

2 Likes

Ah. mostly thank you @pnutalapati for confirming that you got the xcode build working. Just been running this through with a colleague , and similarly got a bit stuck this week. I now have a load of setup step workaround notes for 1.22 appium as well. Every person somehow ends up with slightly different folder names or paths somehow.

We could write a troubleshooter, by now, but we really need to update to appium 2.0 soon anyway.