Deleted hidden files and now Mac won't boot, how do I fix this?

My friend deleted some hidden files on his Mac (OS X 10.9.4) laptop.

After restarting his laptop the Mac just shows loading progress bar and nothing else.

How can we restore the hidden files and get the computer working again?


They're hidden for a reason, & that reason is because you shouldn't go anywhere near them if you don't know what you're doing.

To repair the installation…
At Boot, hold Cmd ⌘ R & go to Recovery, or Internet Recovery if that doesn't work.

See About OS X Recovery
Extract:
OS X Recovery includes a built in set of utilities as part of the Recovery System.
You can use OS X Recovery to do the following:

  • Restore your Mac from a Time Machine backup.
  • Verify and repair connected drives using Disk Utility.
  • Check your Internet connection or get help online using Safari.
  • Install or reinstall OS X.

I would suggest you should attempt in that order, probably ignoring 'verify & repair' as you know exactly why the files are no longer there.

To recover invisible files from Time Machine, you would first need to set the Finder to 'show invisibles' which can be done from Terminal or by Applescript - though I'm not certain how you would do that from the recovery startup.

Failing that, the only option would be to reinstall OS X, either from the Recovery partition or via Internet Recovery - this will replace only the System files, your data will not be affected.