My Mac boots up just fine but as soon as I login, the Dock is gone, Finder doesn't respond, nor does it show files or applications other than some default ones and I can't open them or use Spotlight via command-space.

I don't have a backup of my Mac. I have tried booting it in safe mode, using OS X Internet Recovery and OS X Recovery to try reinstall the OS but since the OS isn't there and replaced with a new OS it can't download, I've tried resetting PRAM. I've tried booting into single-user mode to enter commands to try installing the new OS but didn't succeed.

While in OS X Recovery, I ran First Aid in Disk Utility and it came back that it was fine and all.

I have no idea what to do to fix this. I'd rather fix the computer in my home than try and bring it to someone who can fix it in a shop.

If it helps for information, my Mac is an iMac 27" (about Mid-2012). Here's what it's like in a YouTube video:

Each individual line here should execute without any errors and give you a new prompt to type the next line (except shutdown -r now, that will restart your mac).

Quick disclaimer: You will lose settings to do with this user account. But it should get you back in. Also worth noting that playing around in single-user mode is dangerous. If you mess any of those lines up then the sh*t can really hit the fan. Every space, slash and capital letter must be correct as I typed it above. That said, you have a user account issue - the only way to get the machine working again is going to require an erase so hey-ho!

Each individual line here should execute without any errors and give you a new prompt to type the next line (except shutdown -r now, that will restart your mac).

Quick disclaimer: You will lose settings to do with this user account. But it should get you back in. Also worth noting that playing around in single-user mode is dangerous. If you mess any of those lines up then the sh*t can really hit the fan. Every space, slash and capital letter must be correct as I typed it above. That said, you have a user account issue - the only way to get the machine working again is going to require an erase so hey-ho!

Click to expand...

WAIT!!!. If I do these commands into single user mode, will all my important documents, photos etc be completely wiped off the machine? or will it just reset to the default settings?

WAIT!!!. If I do these commands into single user mode, will all my important documents, photos etc be completely wiped off the machine? or will it just reset to the default settings?

Click to expand...

You haven't been deleting any apps or system files from your Mac, have you? That would cause problems that only a re-install would fix.

Instead of doing what mysteryGenius has suggested, I would instead have the Mac re-run the Setup Assistant. What this will do is let you set up a new administrator account while leaving your present account untouched. This article has a nice explanation:

You haven't been deleting any apps or system files from your Mac, have you? That would cause problems that only a re-install would fix.

Instead of doing what mysteryGenius has suggested, I would instead have the Mac re-run the Setup Assistant. What this will do is let you set up a new administrator account while leaving your present account untouched. This article has a nice explanation:

If this works then you have a pretty good idea that your original user account has some serious issues.

When you set up the new admin account, don't use your name for it and also don't enter any iCloud info.

Click to expand...

I haven't deleted any files. I probably should've mentioned this but if I remember correctly, out of nowwhere my Mac just stopped working one day and when I came to reboot the machine, it was fine until I went to login and then my Dock was gone, finder was completely not responding and I can't access any of my files and I don't know which one to pick, you or mysteryGenius. I honestly don't want my files to be erased.

Alright. I've typed in what you told me to and it restarted fine. I logged in and the dock is there, finder is responding but a message box has popped up stating, "OS X needs to repair your Library to run applications. Type your password to allow this" with two options, 'Cancel' and, 'Repair' but when I type in the passwand press, 'Repair' the message box comes up again.
I can view through finder now but still can't open anything.

--- Post Merged, Nov 30, 2016 ---

Also, I went to re-write the commands in single user mode to make sure I did everything correctly and realised that one of the commands isn't working for me. When I type in chown -R JohnMCrawley /Users/JohnMCrawley/Library/ in. I get this on the next line:
chown: JohnMCrawley: illegal user name

MacRumors attracts a broad audience
of both consumers and professionals interested in
the latest technologies and products. We also boast an active community focused on
purchasing decisions and technical aspects of the iPhone, iPod, iPad, and Mac platforms.