In the menu bar, clickErase All Content and prefs.

This will remove your personal data and any apps you installed without removing macOS.

Connect your MacBook to the internet.

Erasing hard disk

Apple

Otherwise, you won’t be able to wipe the hard disk.

Go tomacOS Utilitiesscreen and selectDisk Utility.

Select your hard disk.

System Preferences window with Time Machine selected

choose the disk rather than any volumes nested within the disk.

Enter anamefor the disk, such asMac HDor whatever else you find appropriate.

If you’re using macOS High Sierra or later, go to the Format drop-down menu andchoose APFS.

Time Machine System Preferences with Select Backup Disk highlighted

If you’re using macOS Sierra or earlier, chooseMac OS Extended (Journaled).

In the Scheme drop-down menu, chooseGUID Partition Map(if shown).

ClickEraseto begin the wiping process.

Time Machine System Preferences with Encrypt backups and Use Disk highlighted

In the upper-left corner of the MacBook Pro screen, click theAppleicon.

Choose your external drive.

ClickEncrypt backupsand then selectUse Disk.

A screenshot of the macOS utilities app

If it isn’t in the ON position, selectONafter clickingUse Disk.

When you do, the MacBook Pro begins creating a backup.

click theAppleicon and selectSystem Preferences>iCloud>Sign Out.

For Messages: PressCommand+Space Bar, typeMessages, and pressEnter.

At the top of the Mac’s screen, selectMessagesand then selectPreferences>iMessage>Sign Out.

On the macOS Utilities screen, clickReinstall macOS.

When the installation is complete, you’ll see the setup/Welcome screen.