Use this checklist to erase your iMac, remove your Apple Account, and prepare it safely for the next owner.
If your iMac has this option, use it first:
Use macOS Recovery, erase Macintosh HD in Disk Utility, then reinstall macOS.
Use Time Machine, iCloud Drive, or an external hard drive.
Go to Apple Menu → System Settings → General → Transfer or Reset → Erase All Content and Settings.
Use the password you normally use to unlock your iMac.
Enter your Apple Account password if asked. This removes Find My Mac and Activation Lock.
Click Erase All Content & Settings and wait for the iMac to restart.
When the setup screen appears, do not log in again. Shut down the iMac for the buyer.
Copy important files to Time Machine, iCloud, USB, or external drive.
Sign out from Apple Account, Messages, FaceTime, Music, and other personal apps.
Intel iMac: restart and hold Command + R. Apple silicon iMac: hold power button until Options appears.
Select Disk Utility from macOS Recovery.
Select Macintosh HD → Erase → Format: APFS. Choose Erase Volume Group if shown.
Quit Disk Utility, then choose Reinstall macOS. Follow the on-screen instructions.
Do not create a new account. Shut it down and give it to the buyer.
Complete this before handing over your iMac.
The buyer should only see the first setup screen. If your name, Apple Account, or old desktop appears, the reset is not complete.