My iMac makes no sound at all My iMac abruptly stopped making any sounds while I was using Garageband. I think I had a microphone and headphones plugged in at the time. 

I have tried everything that is written online: Safe mode, rebooting, fiddling with the output port trying to find the "switch", even launching, creating and saving projects in Garageband (because somebody said that worked). But the problem remains. The computer makes no sound, not even when I plug headphones in. When I go to System Preferences > Sound > Output, the only option available is "Headphones", although I don't have headphones plugged in.

Any suggestions?
In order to try to localise the problem, try adding an additional user to your iMac, and see if this new user also has no sound. 

If the new user has sound, then you can be sure it's not a hardware problem. If the new user has no sound, then it looks like it's a hardware problem.