If you are like me and keep everything on your mac then you will want to know what to do before selling it in order to afford a newer and better...macs always get better :)
Never forget to back up your mac!!
I cannot emphasise this enough. How many of you(like myself) have decided to do a fresh install thinking you have everything backed up only to realise just after clicking format the mac OS disk that you had forgotten bookmarks or a document for work or even your passwords.
Concerning iPhoto back ups, I usually copy all my photos and videos to another external disk as I have experienced problems when using the time machine back up system, it has always failed me LOL
De-authorise your iMac
You obviously want to be able to use your previously bought apps etc
Format then re-install
I usually do a 7 pass erase just to be sure no recovery software can recover any sensitive data.
There you have it. If you have any questions don't hesitate to post a comment and I'll be sure to reply