Need a good way to crash OS X

Is there a "good" way to crash OS X? I need it for testing particularities.

It needs to be good enough not to cause permanent/ unrecoverable damage to the OS and hardware. I know I can just pull-plug (force shutdown via power button), but it seems dangerous to the hardware if done often.

I'm thinking possibly an app that has a ≪Crash OS≫ button? Anyone know of such a thing?


Solution 1:

I assume you mean kernel panic:

Kernel Panic, though sounding scary, is simply an occurrence when your Mac restarts for no obvious reason. Your Mac’s screen goes black giving you various warning messages like “You need to restart your computer.” Note that the presence of the warning message is what distinguishes Kernel Panic from usual Mac restarts and app crashes. In other words, Kernel Panic is just a Mac version of “blue screen of death” on Windows.

To start a kernel panic, you can issue the following command from Terminal:

sudo dtrace -w -n "BEGIN{ panic();}"

You will need to disable SIP if you have El Capitan or later. You can find instructions to do it here. It works for any version of macOS that has SIP, but you should NOT do it unless you really need to, since it is a security risk. If you do, you should re-enable it when your work is done.

Or an even better option is to test your software in a virtual machine using a virtualization software like Parallels or VMWare. This way, you won't damage your computer in any way.

This is not completely harmless if you try it on your actual machine instead of a VM. There is no completely harmless way of crashing your system. In my case, it didn't do any damage to my system, but you have been warned.