Mac operating system and reinstall

Richard Christensen
Richard Christensen used Ask the Experts™
I have an iMac that I am getting ready for sale.  Once I return the unit to the beginning
how do I reinstall the OS?  I want to make sure that all of my data is removed.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
How old is it?

If it was purchased before Mountain Line came out, you may need to Use the installer DVD to wipe it.

If it was a more recent purchase or has any of the newer OS X, you can wipe boot into recovery mode and erase the disk, then install a new OS.  If you had also used filevault, then you don't also need to erase the disk or SSD.

  • Restart the Mac
  • Hold
  • Command r
  • Select Disk Utility and erase the disk.
  • Quit Disk Utility
  • Select Reinstall OS X
  • Reinstall

If you didn't use Filevault, then you can still do a "quick" wipe by writing zeros to the disk after you reinstall.

Open and run the following command
cat /dev/zeros >> zerofile ; rm zerofile

That should be sufficient to prevent normal recovery programs from retrieving data.  It will write zeros to the disk until it fills up, then it will remove that file.  It will take a few hours.

If you need it so that governments and dedicated data retrieval won't happen on a spinning hard disk, you will need to run a multipass DoD wipe, but that can take days.  SSDs work differently and I'm not sure a DoD multipass wipe will be useful.  It's best to have enabled Filevault to avoid needing to do a wipe.
Richard ChristensenRetired computer technician


It is about 5 years old.
David FavorFractional CTO
Distinguished Expert 2018

If you truly desire data removed, use the scrub command line tool, to scrub all your user directories... well... except root.

I like scrub as it's free + can generate brutal destruction of files/directories/devices easily. There are many other tools like scrub, if you prefer.


1) Enable root access if it's off + login as root.

2) Run scrub on all /Users/* directories.

3) Run installer (either off download or DVD).

4) Select repartition disk.

5) Install OS.

Apple provide a fairly simple process to reset your mac to factory condition .. and will not require all the steps which David outlines which are more relevant to other Unix/Linux systems.

There is an excellent step-by-step guide online here -
It covers the pre-format tips to signout and decouple the Mac from your iCloud and Apple device management and other accounts before you begin the erase, reformat and reinstall OSX.

Assuming you've a backup taken .. logged out of all accounts and services the basic process is to power on the Mac while hold down the Command+R keys simultaneously. You're Mac will boot into macOS Recovery mode where you can erase and re-format the drive .. if you're paranoid you can do a secure multi-pass overwrite of the hard drive to purge any trace.  Then you can reinstall OSX from the Internet directly from Apple .. you clearly need a WiFi or Ethernet connection but this is the default method for all macs for many years now since they dropped DVD drives from their devices.

If you don't have Internet access you've be advised to create an external HD with the OSX installer on it .. plenty of tips online on how to do that also.
Richard ChristensenRetired computer technician


Thanks to all the experts who contributed answers.  Much appreciated.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial