That's not as good, because may leave third-party software on the Mac and you may unintentionally leave personal data on the Mac...
You can open System Preferences Users & Groups pane (or it many be User Account pane depending on OS X version). Create a new user account, and give the new user account a generic name, such as "New User," with a password that you can provide to the new owner. It needs to be set up as Administrator, NOT Standard.
Log out and log in to the new user account. There may be some setup screens that come up. Do not enter any of your personal information, such as your Apple ID. Open System Preferences Users & Groups pane. Delete your usual user account, and choose the option to delete your user data. If you created any other old user accounts on the Mac, delete those user accounts too.
In Finder, look at places outside of your user account home folder, for any personal data. For example, there is a Shared folder in the Users folder. Delete any personal information that you find. You should also delete third-party apps (apps that did not come pre-installed) that are licensed to you, unless you plan to also transfer the software licenses to the new owner. Be sure to empty the trash when you are done manually deleting stuff.
Run Disk Utility. In the sidebar, select the internal drive volume (not the drive). It is usually called Macintosh HD, unless you changed it. Go to the Erase tab. There is a button to Erase Free Space. Click it and choose the option to Zero Out Deleted Files. Click Erase Free Space. (Wording may be a bit different depending on OS X version.) This writes zeros over the internal drive's free space, to make deleted files unrecoverable. But your concern is not deleting personal data that is in an unexpected location.