MacOS – deleted private/var folder

macostrash

I have done a foolish thing. I deleted private/var folder due to malware I was after. I immediately felt that strange things are beginning to happen so I pressed cmd+Z to reverse action. The computer frezzed so I shut it and rerun it. Now I cant relaunch it, because it shuts down while it is loading into my user account.

So I went to single user mode and and tried to copy the var folder from .Trashes to private folder. The problem is that .Trashes seem to be empty. Meaning that cmd-Z worked, which would mean that var folder is back in place. But the computer doesnt start. Does ls command dosnt show files in trash? What seems to be the problem?

Also, if this doesnt work, I am gonna have to copy important files to external disc from Single user mode. What is the path to external harddrive?

EDIT > private/var does indeed have content. I am now getting confused. Did the system put some content in there for me?

Best Answer

If you assume a malware infection, by all means reinstall the OS by rebooting into the Recovery Partition with Cmd-R and reinstall from there. This should not affect your existing users (or their files).

See OS X: About OS X Recovery for details about the procedure.