Factory reset from terminal

I am wondering if there is a way to trigger a factory reset with terminal.

My osx install is damaged after some disk operations and now I can't charge the laptop. It will die soon.

I have tried rebooting into safe mode and it just hangs at the white apple logo indefinitely.

Thank you for any input C


Solution 1:

This is not a command line base operation, but on many recent OS versions, the process is as follows for a clean installation or try to repair your installation using this method when you are turning on your MacBook:

  • Apple silicon: press and hold the power button until “Loading startup options” appears, select Options, click Continue, then follow the onscreen instructions.

  • Intel-based Mac you have 3 options:

  1. Install the latest version of macOS compatible with your computer: Option-Command-R
  2. Reinstall your computer’s original version of macOS (including available updates): Option-Shift-Command-R.
  3. Reinstall your current version of macOS: Command-R.