Unable to boot device due to insufficient system resources using Xcode 9

27,993

Solution 1

You should increase the allowed running processes for your system. You can modify the limits through Terminal. The command for that is the following:

sudo launchctl limit maxproc [limit for one user] [total limit]

Inside Simulator Help, Apple's example values are 2000 for one user and 2500 total.

After setting up the values, quit iOS Simulator, then restart Xcode and try launching a simulated device again.

However, keep in mind that this can slow down your system and make the OS unstable. Since these values are only permanent until the next restart, you should reboot your system and it will restore these values to default.

From Simulator Help:

WARNING: Setting the the maximum number of processes to a number that is too low can prevent your Mac from operating correctly. Restart your machine to restore the original limits.

Solution 2

Following command helped me out. Try pasting the below command in the terminal and it should solve your problem.

sudo launchctl limit maxproc 2000 2500

Solution 3

Alternatively you can quit the current Simulator and then launch the Simulator again (ideally for a different iPhone version).

Solution 4

This error happens to me after I rename my simulators.

I just renamed back to what its name before and restarting the machine do the fix for me.

As what Apple have said:

Restart your machine to restore the original limits.

So any changes that I made to that limits, which I don't even know other than renaming simulators, will be back to original.

Try restarting your machine first, before doing what's in the right answer.

(This might also helps you prevent the slow down of your system. Cheers!)

Solution 5

What other people already answered works. Here's a way to also set the values independently with sysctl:

To set the total max # of processes:

sudo sysctl kern.maxproc=<VALUE>

To set the max # of processes per user:

sudo sysctl kern.maxprocperuid=<VALUE>

Where <VALUE> is whatever value you want to set them to.

NOTE: Some people say to use -w as a param to sysctl. You can...it won't hurt anything. But, it's deprecated in modern versions of MacOS.

You can list the current values with these commands:

sudo sysctl kern.maxproc kern.maxprocperuid

Those settings will not persist across a reboot. To persist the values across a reboot, do something like what is in this post: https://discussions.apple.com/thread/2781309

I.e., create a plist file in /Library/LaunchDaemons (e.g., sysctl.plist) that sets the values as you want them. Here's an example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
 <key>Label</key>
 <string>sysctl</string>
 <key>ProgramArguments</key>
 <array>
 <string>/usr/sbin/sysctl</string>
 <string>-w</string>
 <string>kern.maxprocperuid=1024</string>
 <string>kern.maxproc=2048</string>
 </array>
 <key>RunAtLoad</key>
 <true/>
</dict>
</plist>
Share:
27,993
Sanoj Kashyap
Author by

Sanoj Kashyap

I am a Senior iOS developer. Working in Bangalore. #SOreadytohelp

Updated on October 10, 2021

Comments

  • Sanoj Kashyap
    Sanoj Kashyap over 2 years

    When I try to launch an iOS Simulator from Xcode 9, the following error pops up:

    "Unable to boot device due to insufficient system resources" error dialog

  • Aditya
    Aditya over 5 years
    Ideally, it works without restarting Xcode, need to know why exactly you faced the issue so you have to restart Xcode.
  • Lalit Kumar
    Lalit Kumar almost 4 years
    Tried above command and everything stopped working. Restarting mac resolved issue. Just be careful before using this command
  • Tamás Sengel
    Tamás Sengel almost 4 years
    @LalitKumar I'm sorry to hear that, try using higher values if this issue comes up again.
  • Eric Aya
    Eric Aya over 2 years
    This has already been mentioned in other answers like this one. When answering older questions that already have answers, please make sure you provide either a novel solution or a significantly better explanation than existing answers.