63

Hey all basically what the title says, I was working on my project with no issues and then all of the sudden it just stopped compiling. The only thing that led up to this was one of my .m files turned red when I accidentally renamed it and I had to delete it and replace it but that was it. I searched around and can confirm it is not my Bundle Id that is causing the issue. I also ran it with llvm-gcc and got this 'llvm-gcc-4.2 failed with exit code 1' and help? Thanks!

ETA: This is also what it says in the little error box:

clang: error: unable to execute command: posix_spawn failed: Resource temporarily unavailable clang: error: clang frontend command failed due to signal 1 (use -v to see invocation) Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 255

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
Adam Ashwal
  • 1,472
  • 1
  • 19
  • 36

9 Answers9

195

I just had that same error, same situation(the code worked totally fine, then suddenly has that error message). For me I just closed the simulator and opened it again then xCode does not complain anymore.

Have you tried to run your code in device?

nluo
  • 2,147
  • 1
  • 14
  • 11
  • 1
    me too. restarting the simulator fixes this. – Jess Bowers Jan 28 '13 at 22:23
  • 7
    Actually rebooting Mac will fix the issue. I had similar problem when running on simulator and then also on device. restarting simulator an device fixed issue temporarily. Then I rebooted Mac and everything started working fine and faster. – krisrak Feb 12 '13 at 17:02
  • rebooted mac, cleaned build & folder... then was fine! – Liam Mar 21 '13 at 12:37
67

This is happening because your OS X install is running into the per-user process limit. And that's happening because XCode doesn't always cleanly kill your process at the end of a debugging session.

On my machine, I have 709 processes allowed per user:

El Smeg:~$ sysctl kern.maxprocperuid
kern.maxprocperuid: 709

Looking at the number of zombied processes on my machine:

El Smeg:~$ ps aux | grep \(GridView\) | wc -l
 608

So you can see that I'm pretty close to the per-user process limit just due to XCode leaving zombie processes around.

Unfortunately, I don't see a good way to kill these off. kill -9 doesn't work. Rebooting seems to be the only fix aside from temporarily raising your per-process limit, which isn't really a fix. You can't kill the parent process because that's launchd and killing that is pretty much equivalent to a reboot anyway.

Jason Harris
  • 2,317
  • 17
  • 10
  • There is ***no*** way to kill a zombie process. That's by definition. At least on Linux, I take it it's the same on Darwin. – Maciej Swic Feb 28 '13 at 09:09
  • 1
    Great answer - for those who are a bit slow like me replace the 'GridView' in the ps aux grep with your project name. I got 558 zombies. But my machine has been up for 39 days, so due a reboot I guess. – Richard Groves Apr 24 '13 at 09:22
  • I have only 1 zombie process for my Project, still it's giving the same error. Looks like something related to longer paths! – abhinavroy23 Mar 06 '18 at 10:28
21

For me, I just had to reboot (OS X 10.7, Xcode 4.5).

jab
  • 4,053
  • 3
  • 33
  • 40
  • 1
    None of the usual suspects worked for me. Rebooting xcode, cleaning, removing the DerivedData. Reboot cleared it up immediately. – Julian Oct 29 '12 at 21:25
2

Roboot your MAC, Launch xcode and before doing anything clean up your project (cmd+shift+k).

riyaz
  • 1,093
  • 1
  • 8
  • 21
2

I have had this a few times. The simplest way I have found to fix it is just to close the simulator.

Alan
  • 692
  • 1
  • 7
  • 16
2

maybe this could be useful to someone.

I had the same problem, and it is just because I compile with make -j.

As you know, this causes make to use as many threads as possible, and I think one of these threads was using a ressource when another one tried to access it.

Let make -j compile until the error, it will end automatically, and then just do make.

It should work normally.

Of course, you can just compile with makefrom the beginning, but it will be longer.

1

I tried it with Xcode 11 beta and its not work, I changed the build configuration to Release and its works like a charm. Project---> Edit scheme----> Run ---> Build Configuration---> Release

Ahmed Abdallah
  • 2,338
  • 1
  • 19
  • 30
0

I just ran into this, closing xcode and reopening it did the trick. I am curious now if purge would have done anything.

j_mcnally
  • 6,928
  • 2
  • 31
  • 46
0

I did the clean and rebuild, also did "remove the app from the simulator". The problems just did not go away, sometimes it shows up as another compiler error on a xib file (which is a false alarm). Eventually I did reboot the machine and it fixed the problem.

I recall doing the kill Xcode/simulator process in the past, but can not recall the exact situation.

uudaddy
  • 341
  • 4
  • 9