Playgrounds Don't Run - Period

With the update to macOS Seirra 10.12 and iOS10 we've observed a trend in Apple product quality that has degraded. It appears that each of these updates now run exteremly slow and the updates contain numerous bugs. In this case "Anyone can code but not everyone can launch an Apple Playground"


As an example - on XCode Version 8.0 (8A218a) we have tried every suggestion on this forum in trying to get a new Playground to launch for iOS and macOS however the default template from Apple does not want to run at all. Here are the errors shown after simply launching an iOS Playground, has anyone found a productive solution to this issue??????


Playground execution failed: error: Couldn't lookup symbols:

__swift_FORCE_LOAD_$_swiftCoreGraphics

__swift_FORCE_LOAD_$_swiftCoreImage

__swift_FORCE_LOAD_$_swiftFoundation

__swift_FORCE_LOAD_$_swiftObjectiveC

* thread #1: tid = 0x39ef7, 0x000000010c9b43c0 MyPlayground`executePlayground, queue = 'com.apple.main-thread', stop reason = breakpoint 1.2

* frame #0: 0x000000010c9b43c0 MyPlayground`executePlayground

frame #1: 0x000000010c9b39c0 MyPlayground`__37-[XCPAppDelegate enqueueRunLoopBlock]_block_invoke + 32

frame #2: 0x000000010d7b125c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12

frame #3: 0x000000010d796304 CoreFoundation`__CFRunLoopDoBlocks + 356

frame #4: 0x000000010d795a75 CoreFoundation`__CFRunLoopRun + 901

frame #5: 0x000000010d795494 CoreFoundation`CFRunLoopRunSpecific + 420

frame #6: 0x0000000112948a6f GraphicsServices`GSEventRunModal + 161

frame #7: 0x000000010e33ff34 UIKit`UIApplicationMain + 159

frame #8: 0x000000010c9b36e9 MyPlayground`main + 201

frame #9: 0x0000000110a9a68d libdyld.dylib`start + 1


Thanks

Replies

There’s clearly something broken about your specific Xcode install; playgrounds work just fine for the majority of folks. I recommend you start by getting a handle on the scope of the problem:

  • If you create a new user on your Mac, does that user see the same issue?

  • Does the issue reproduce on a different Mac? [If you don’t have a second Mac handy, use a VM; they’re great for this sort of investigation.]

  • What about a freshly-installed Mac?

Ultimately this is going to end up as a bug report — because no matter what’s causing the problem in your specific it’s clear that Xcode should be deal with that better — but bug reports like this work best if you can include some sort of diagnostic info.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hi Eskiomo Man,


Thanks for the suggestions - I tried another account on the same mac and received the same response indicating an uncaught exception by simply starting a brand new playground in two different accounts on the same Mac. However note the following:


  1. iPhone Simulator Similar Anomalies
    1. Whenever I launch the iPhone simulator on XCode for any of my porjects it takes FOREVER for the simulator (iPhone 7) to launch.
    2. After the simulator finally does launch and the Apple logo appears and the progress bar shows it booting iOS in the iPhone simulator, XCode times out complaining that it couldn't attach to the iPhone simulator
    3. However, if I simply click "play" in XCode a second time and try to launch my app a second time on the (now already open) iPhone simulator - IT WORKS!! So "do over always works" and the first time connection to the iPhone simulator ALWAYS FAILS.
  2. Playgrounds Work IFF (if and only if)................
    1. If I do NOT launch the iPhone simulator first but instead simiply open a playground............
    2. It also takes a very long time for the Playground window to finish launching as shown by the spinning wheel with the "Launching Simulator" string in the Playground window
    3. After it does finally launch however - THE PLAYGROUND WOKRS!!!
  3. Additional Playground Anomalies
    1. After getting the Playground to launch per [2] above I also observed the following odd output from Swift in the playground
      1. let eskimo = 5 Result: 5
      2. let x1 = 2^3 Result: 1 (expected 8)
      3. let x2 = 4*3 Result: 12
      4. let x3 = 2^2 Result: 0 (expected 4)
    2. So [3a-2] and [3a-4] do not produce expected results


I think there is a common root cause issue with the simulator for both iPhone and Playgrounds being broken. Do you have a suggestion for resetting or cleaning up the simulator and simulator connectivity to XCode/Playgrounds without suggesting a clean install of my Mac(s)? That would take a crazy amount of time to get back to my original configuraiton unless you have a way to **** away the simulator pices and re-install those separately???? Haven't tried another Mac yet but will do that next.


Additional note, all the above also applies to the most recent updates of XCode to version Version 8.1 (8B62) and macOS Sierra Version 10.12.1 (16B2555)


Thanks

Post not yet marked as solved Up vote reply of s23 Down vote reply of s23

Do you have a suggestion for resetting or cleaning up the simulator and simulator connectivity to XCode/Playgrounds …?

No, sorry, I don’t have any specific advice on this front (although you’ll probably find information along these lines elsewhere on the ’net).

Haven't tried another Mac yet but will do that next.

Well, I recommend you start with that. I’d hate to have you spend a bunch of time resetting your Mac only to discover there’s something else in play.

Just a reminder of something I mentioned earlier, VMs make this sort of testing much easier.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

So we've been dealing with the slowness and just not using playgrounds since the iPhone simulator works (everytime if we let it fail on 1st XCode attach and then try to attach a 2nd time). We're basically using the debugger and print() function instead of playgrounds because destroying our software installations is not a practical option right now.


I do have a question about VM's though. Do you have a link or a recommended procedure to use a VM on our macOS Sierra installations to try a VM? Are you suggesting we use VirtualBox on a Windows PC or Parallels on a Mac to do another installation of macOS Sierra and XCode tools on that VM?


Thanks

I do have a question about VM's though.

I do a lot of Mac-on-Mac virtualisation. I have one main work Mac running the latest version of macOS; this is generally OK for day-to-day testing but there are lots of situations where I need to do otherwise:

  • If I’m debugging something that’s inconvenient (or unsafe!) to install on my main Mac (kernel extensions, Open Directory modules, auth plug-ins, and so on).

  • If I need to test on a different version of macOS; right now I have VMs for 10.7, 10.8, 10.9, 10.10, 10.11 and 10.12 installed!

  • If I need to test on a fresh machine, one without the day-to-day buildup of cruft I get on my work machine.

OS X 10.7 and later support being run as a guest inside a VM (10.5 if you consider OS X Server) as long as the VM is hosted on a Mac.

I use VMware Fusion for running my VMs but that’s more an accident of history than a deliberate choice (back in the day I had some friends working on that team).

There are some things that don’t work well in a VM. Most notably, the current VM hosts don’t support graphics acceleration with Mac guests, so anything that relies on high-speed graphics does not work well. Fortunately my area of expertise is low-level goo, so that doesn’t bother me.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Ok here's the latest update. The following steps drammatically improved performance and made XCode now feel much more functional:


  1. Replaced the conventional hard drive on this MacBook Pro with a Micron 3D NAND SSD Drive - wow what a performance improvement. Interestingly for the first 3 min all CPU cores were throttled up to max with Finder and Spotlight indexing the drive but the CPU cores & hardware threads are now at a "calm idle" level.
  2. Deleted XCode completely from this machine and did a fresh install from the App Store


Additional note for anyone paying close attention - I used Mathematica syntax in this Playground line above to try and rais 2 to the 3rd power......

let x1 = 2^3 Result: 1 (expected 8)

That was ok syntax for Mathematica notebooks but not for Swift. Here's what I should have typed (and this worked)

let x1 = pow(2,3) Result: 8 as expected


Eskimo I really appreciate your help - we'll give the VM's a try as well - lots of code to write now though.


Thanks again.

Hi, I was having this problem - driving me crazy for over a week. Finally, this has solved it:

rm -rf ~/Library/Caches/com.apple.dt.Xcode

rm -rf ~/Library/Developer/Xcode/DerivedData

defaults delete com.apple.dt.Xcode


ls -l /var/folders/??


and identify which one has your own username as the owner of the contents. In my case it was /var/lfolders/dh.


Then create another user-account (if you don't already have one), with admin privs (via System Preferences -> Users & groups). Logout (or perhaps, better still, reboot). Then login as your alternate user (just created above, if necessary), open a terminal and run this:


sudo rm -rf /var/folders/dh


Ignore errors about some folders which cannot be deleted.


Then logout and login again as your main user-account. Now try launching Xcode and run that playground. If that's all good then regular Xcode projects should also be able to use the debugger. Note that you will have to re-enter your apple ID in Xcode for working on real projects.


How did it all get screwed up in the 1st place? I suspect it was from an OS crash at some point.


HTH, Richard.

Based on what I can see this series of statements appears to be a Cache cleaning exercise for XCode. So I decided to do something similar however from a much simpler process. This actually clears more than just XCode cache, basically all caches. I'm not sure if eggzotic is a temporary or permanent solution, mine I suspect will only be temporary (days).


The most important thing at this time for me was to get a Playground session to run. And this worked.


1. First I saved off my existing Playground session as a file.

2. Shut down Simulator AND XCode. I think there is a conflict between Simulator and Playgrounds so I ensured Simulator was not running.

3. Run "sudo purge": Open a Terminal window, type "sudo purge", enter admin password.

4. Restart XCode and Re-Open existing Playground file. (Do not reopen Simulator).


I recommend doing your own research into the use of Purge in MacOS. This isn't a new concept and has been used by many as a way to improve overall performance until caches become a problem again. In fact there are a number of apps on the AppStore which are basically doing the same thing for a price.