Shut down your iMac. Next, power your iMac back on. Just after you hear the startup tone, press and hold the “Shift” key. You can release the Shift key after you see the gray Apple and progress indicator. Your Mac should boot up into Safe Mode. Then reboot your iMac and test under a normal boot up.
Starting up into Safe Mode does several things:
The best way is to boot for your original installation disk, and use disk utilities to "repair disk". If, for some reason, your installation disk isn't handy you can do the same thing by booting into single-user mode (by depressing the command (Apple key) and S keys at startup), which takes you to a terminal-like screen. At the prompt there, type the command: "fsck -yf" (without quotes and note the space). If it doesn't find the command, type /sbin/fsck -yf instead. If it complains about permissions type: "sudo /sbin/fsck -yf" and provide the admin password XXXXX prompted. If it finds errors, repeat this command until no errors are reported and you see the "...OK" statement. This check may need to be run up to four times on a system with serious problems. When you get the "...OK" message, type “Reboot”. Your Mac will restart and return you to the User Interface.