It might sound unusual, but even iMacs and MacBooks can be a little bit touchy sometimes. It’s highly likely that a reboot is meant to do the job, and only in really bad cases, a TimeMachine backup transfer or OS re-installation might be necessary.
However, as robust and seemingly invulnerable as MacBooks and iMacs are, the worst case scenario could also be a hardware defect.
Here is a really easy method using an Apple standard application to figure out if it’s actually your hardware that causes all the trouble.
The tool is called “Apple Hardware Test” (AHT), which has a number of different methods of diagnosis to test your machine systematically. AHT is an in-built Apple tool that should sit on you recovery drive, and if it does not, it can be easily accessed via internet.
First, unplug all external devices, such as printers, external hard disks, thumb drives, monitors etc. – you don’t have to unplug mouse and keyboard if your are testing your iMac. Next, shut down your computer – not just reboot your machine. Turn it on again and hold down the key before the gray login screen appears. You should see the diagnosis menu now (see picture).
If the diagnosis menu screen didn’t appear and you see the login menu instead, you might have to load the AHT from the internet. Therefore, you need to have a working Wifi or Ethernet connection of course. Now, shut your computer down and, and then hold down the keys
<D>+<option> until you see the diagnosis menu appear.
Choose your language from the AHT menu and click on the arrow in the bottom right corner.
On the next screen you can choose from two different scan options now: the default scan that takes ~ 3 min and an extended scan, which is more thorough but takes up to ~ 1h.
After the test is completed you may choose to either restart or shut down your machine now.