My iMac refuses to log me in

Solution 1:

One thing to do would be to trick the iMac into thinking its a new setup but jumping into single user mode and deleting the .AppleSetupDone file in /var/db.

Restart the mac and it'll act like the machine has just been pulled out of its box. (all your data and accounts are still on there).

Create a new admin account and see if you can login. You should be able to. If not something is seriously broken. If you can, run the standard system checks to see if anything is amiss.

Solution 2:

Sounds like something's screwed up on a system level. The guest account might only be working because it might be configured such that files don't need to persist: IE, it doesn't need to be writing files to the disk.

Backup your files, reformat, and start from scratch. It might be repairable still, but you'd need to spend a lot of time investigating and fixing, or you'd need to hire someone.

EDIT: Silly me, I didn't read it as thoroughly as I could have. Boot from an OS X disk, go past the first screen (careful -- don't wipe your data) until you see the Utilities menu. You want Disk Utility. Run a verify and perhaps a repair if it finds anything. Run a verify afterwards again to make sure problems are fixed.

You can also try DiskWarrior, which in my experience is more thorough (and capable) than Disk Utility, but isn't free.