If you need to factory reset your Mac using the Terminal, the command is eraseInstall (for Intel Macs) or erase (for Apple Silicon Macs), run from macOS Recovery. This guide walks you through both methods, what they do, and how to avoid common pitfalls.
What a Factory Reset Actually Does
A factory reset erases your startup disk and reinstalls a fresh copy of macOS, removing all your files, apps, and settings. On modern Macs, this also disables Activation Lock (if you sign out of iCloud first) and returns the computer to a state close to when it left the factory. The Terminal method is one of several ways to do this, and it is the only option when the normal System Settings reset fails or when you want to securely erase the disk.
Why Use Terminal Instead of System Settings
macOS Ventura and later include an “Erase All Content and Settings” option in System Settings, which works well for most users. However, the Terminal method is useful when:
- The graphical erase tool crashes or hangs.
- You need to erase a disk that isn’t the startup volume (e.g., an external drive).
- You want to force a secure erase (overwriting data) on an older HDD.
- You are comfortable with command-line tools and want more control.
Before You Start: Backup and Sign Out
This process permanently deletes everything on your Mac. Before proceeding:
- Back up important files to an external drive or cloud service (Time Machine or a manual copy).
- Sign out of iCloud (System Settings > Apple ID > Sign Out) to disable Activation Lock.
- Sign out of iTunes/App Store if you have an older macOS version.
- Note your Apple ID and password—you’ll need them to reinstall macOS after the erase.
- Unpair any Bluetooth devices (like an Apple Watch) that are linked to the Mac.
How to Factory Reset via Terminal (Intel Macs)
Intel Macs use the eraseInstall command, which erases the startup disk and reinstalls macOS from the recovery partition.
- Restart your Mac and hold Command (⌘) + R immediately after the Apple logo appears to enter macOS Recovery.
- In the Recovery menu, select Utilities > Terminal from the menu bar.
- Type
eraseInstalland press Enter. - Follow the on-screen prompts: choose the disk to erase, confirm the erase, and let the installer run.
- When finished, your Mac will restart to the setup assistant, as if new.
If eraseInstall is not recognized, you may be on an older macOS version; try erase instead, or use the Disk Utility method described below.
How to Factory Reset via Terminal (Apple Silicon Macs)
Apple Silicon (M1, M2, M3) Macs use a different recovery process and the erase command.
- Shut down your Mac, then press and hold the power button until you see “Loading startup options.”
- Click Options and enter your admin password to open Recovery.
- In the Recovery menu, go to Utilities > Terminal.
- Type
eraseand press Enter. - The Erase Assistant will open: select the volume to erase (usually “Macintosh HD”), confirm, and let it complete.
- After the erase, the Mac will reboot to the setup assistant. If it doesn’t, shut down and re-enter Recovery, then choose Reinstall macOS.
Alternative: Disk Utility + Reinstall
If the Terminal commands fail or you prefer a graphical approach, you can erase the disk manually:
- Boot into Recovery (same methods as above).
- Open Disk Utility.
- Select the internal drive (not the volume) and click Erase.
- Choose format: APFS (for SSD) or Mac OS Extended (Journaled) (for HDD), and GUID Partition Map as the scheme.
- Close Disk Utility, then choose Reinstall macOS and follow the prompts.
Common Problems and How to Fix Them
- “eraseInstall” not found: You’re likely in the wrong recovery mode or on an older OS. Try
eraseor use Disk Utility. - Erase fails with “Couldn’t unmount disk”: This happens when the disk is in use. In Disk Utility, click the “Mount/Unmount” button to unmount it first, then erase.
- Activation Lock still on after erase: You must sign out of iCloud before erasing. If you forgot, you can turn off Find My Mac from iCloud.com using your Apple ID.
- Mac restarts to a folder with a question mark: The system couldn’t find a bootable OS. Re-enter Recovery and reinstall macOS.
- Terminal asks for a password: This is normal; enter your admin password (the one you use to log in).
What About Secure Erase?
On solid-state drives (SSDs), a standard erase is sufficient because data is encrypted and the encryption key is discarded. On older hard disk drives (HDDs), you may want to overwrite the data for added security. In Disk Utility, after selecting the drive, click Security Options and choose a level of overwriting (from 1 pass to 7 passes). Note that this takes much longer and is unnecessary for most users.
Frequently Asked Questions
Will a factory reset remove viruses or malware?
Yes, a factory reset erases the entire disk, including any malware. However, if your backup contains the malware, it will be restored. After resetting, only restore files you trust, and consider reinstalling apps from official sources.
Do I need an internet connection to factory reset?
Yes, to reinstall macOS, your Mac needs an internet connection (Wi-Fi or Ethernet). The recovery environment downloads the macOS installer from Apple’s servers.
How long does a factory reset take?
The erase itself takes a few minutes, but the macOS reinstall can take 30–60 minutes or longer depending on your internet speed and Mac model.
Can I cancel a factory reset once started?
You can interrupt the erase process, but it may leave your disk in an inconsistent state. It’s safer to let it finish. If you need to cancel, press Command+Q in Terminal or force restart, but you’ll likely need to reinstall macOS anyway.
Will I lose my Windows partition if I have Boot Camp?
Yes, a factory reset erases the entire disk, including the Boot Camp partition. Back up any Windows files separately if you need them.
Is the Terminal method safe?
Yes, it’s an official Apple command-line tool. As long as you back up your data and follow the steps, it’s as safe as using the graphical method.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Tongue Escape Codes: What They Are0.20 movements/s
- Claude Code Workflow Habits Worth Trying
- HDMI 2.1 Explained: Why It Matters for Gaming
- Veeam Plugin for VMware Cloud Director: How It Works
- Best Path of Titans Server Hosting: Top Picks
- Oppo First Foldable: 120Hz Display & Snapdragon 888