34

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

Tamás Sengel
  • 47,657
  • 24
  • 144
  • 178
Sandy
  • 4,714
  • 4
  • 42
  • 69
  • 2
    Looks like a duplicate of [Xcode 9 Server: Unable to boot device due to insufficient system resources](https://stackoverflow.com/questions/46360878/xcode-9-server-unable-to-boot-device-due-to-insufficient-system-resources) – halfer Oct 31 '17 at 22:00
  • I found the duplicate [using this DDG search](https://duckduckgo.com/?q=Unable+to+boot+device+due+to+insufficient+system+resources+using+Xcode+9). – halfer Oct 31 '17 at 22:02
  • 1
    don't want to do the command below. I just restart my laptop and it's ok – liu pluto Mar 29 '18 at 01:14

11 Answers11

38

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

raurora
  • 3,565
  • 1
  • 20
  • 29
Aditya
  • 1,369
  • 9
  • 19
  • Ideally, it works without restarting Xcode, need to know why exactly you faced the issue so you have to restart Xcode. – Aditya Jan 17 '19 at 08:02
36

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.

Tamás Sengel
  • 47,657
  • 24
  • 144
  • 178
5

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

Prabhakar Kasi
  • 491
  • 3
  • 14
3

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!)

Pepeng Hapon
  • 327
  • 1
  • 14
2

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>
stuckj
  • 946
  • 13
  • 24
2

In my case, it was a lot simpler, my Mac's storage was full. I deleted a couple of GB of unused stuff, restarted the Mac, and it worked fine.

Tamás Sengel
  • 47,657
  • 24
  • 144
  • 178
2

I closed Xcode and Simulator and then restarted my computer and the error went away. It has been 3 days and it has not returned. Before making changes to settings I recommend restarting first.

KinneyKare
  • 73
  • 6
1

In my case, i simply quit the xcode and reopened. It worked.

Or, If you have multiple instances of simulator open, then in that case also such error shows, so quit all other istances of the simulator and run the app on your desired simulator.

Amit Thakur
  • 831
  • 9
  • 13
0

In my case I had another account in which Simulator was running.

  1. Locked screen.
  2. Switched to other account.
  3. Quit Simulator.
  4. Came back to current account and it worked.
vikas chandra
  • 146
  • 1
  • 6
0

In my case I have a lot of open simulators, after closing most of them the error disappers

0

xCode 12.4 In my case no simulator was showing. Solution was to click on Apple icon, select force quit and choose simulator.

reb
  • 1