How to recover a dead Mac mini? A friend of me just deleted everything by running sudo rm -rf / on his Mac mini. Yeah I know...

(Another friend of us just create a cloud virtual box and invite us to play, that poor friend asked how to play with it, I said "sudo rm -rf /" for joking but oh dear I never knew he ran it on his own Mac, now things became serious)

And Mac mini 2014 the hard disk is fixed on the board. Now what can we do to save the system and recover some important files?
First the bad news, there is no simple 'un-rm'/un-delete and everything will be as it was before. 

Assuming your friend doesn't have a TimeMachine Backup of the Data (hence the implied urgency), there are several steps involved:


Access the device
recover deleted files 
rebuild the system


re 1: If you have access to another Mac and you have a thunderbolt cable, you can try to access the drive of the MacMini with "Target Disk Mode" (hold T on Startup, see Apple Support here). You can then try to recover the files (Step 2), f.e. with a GUI based Software (usually commercial) like 'Disk Drill', 'File Salvage' or 'Data Rescue' (of course there are others). Most of the commercial Software have a Demo-Version, so you can try before you buy.

If you don't have access to another Mac or a TB Cable you could try to start the recovery partition with Cmd + R and then run the Terminal, trying to recover files via the Terminal with the methods mentioned on this Post in 'SuperUser', 

If your friend is uncomfortable with the Terminal, he/you could try to install OSX on a USB-Stick or an external Harddrive and boot the MacMini from the external Drive (see Apple Support here). You could then try to run the GUI-Software mentioned in Step 1.

Just to be clear - a recovery of Data and the OS 'in Place' (on the same Harddrive/Machine you trashed before) is not advisable, even if it would be possible. You are most likely overwriting the Data you want to recover. Your friend should have another Harddrive ready to copy the recovered Data to. After recovery we get to step 3.

re 3: After recovering the important Data to another Drive you can rebuild the System. Again, start the MacMini in recovery Mode (Cmd + R) an choose Reinstall OS X (see Apple Support here for detailed instructions).