MacOS/Xcode fails in simulator first time only

I get this error when Building/Running any of the C examples on MacOS with Xcode.
But it only happens on the first time after I change code.

So ... change code ... build ... build succeeds .. get error message running in Sim.
Build again ... build succeeds ... runs fine in Sim.

And if I don't change any code, I can hit the Build/Run arrow over and over and it's fine.

macOS Monterey v12.3.1
Xcode v13.3.1
Playdate SDK 1.11.0

This is a bug in macOS. If you open the Terminal and enter this command (replacing the SDK path) it will fix it:

sudo xattr -r -d com.apple.quarantine <path to playdate sdk>/PlaydateSDK

That didn't seem to work.

I entered:
sudo xattr -r -d com.apple.quarantine /Users/derekmorris/Developer/PlaydateSDK
Then I entered my system password.

I tried rebooting too.

Oh, in your case you have to run it on the location you're building your game, e.g. /Users/derekmorris/GitHub/PlaydateGame

That doesn't work either. I wonder if it's stopped working on Monterey?

I can live with it. Just wondered if there was an easy fix. Thanks.

Hum, I just ran into this issue this morning with downloaded code and that fixed it for me. I'm at a bit of a loss as to why it's not working for you. Try deleting your game completely and rebuilding it after running this command if you haven't already.

Tried cleaning all build files and rebuilding.
I also ran that command on the build and build/Debug folders as that's what's showing up in the error but no joy.

I'm having the same problem as described here and wondering if anyone has had any luck in resolving?

I'm on an M1 Mac, Ventura 13.1 and Xcode 14.2.

Did you try the solution above? @twenty3

You could also try giving the Simulator full access in macOS system preferences privacy file access.

@matt, I did try all the above without any luck so far. It is interesting that doing a 'build' command, followed by a 'run' command from Xcode it will succeed.

Need to get some time to look at what happens in the run step in Xcode to see if I can isolate what is changing. Part of me wonders if it is a timing thing, like perhaps if the launch to the sim was a little delayed would it work in one step?

Related? Missing/incorrect dependencies for simulator DYLIB rule in common.mk - #4 by dave

Possibly, though when I build with Xcode there is always a zero size pdex.bin. I assume this is because the Xcode project only builds the pdex.dylib needed for the simulator?

That's correct; it is zero size because it's not needed in the Simulator builds.

1 Like

The zero-byte pdex.bin also happens when make is doing parallel builds, because there's a bug in our C_API/buildsupport/common.mk file: The pdc target should depend on device as well as simulator so that it finishes compiling pdex.bin before running pdc.

1 Like