Accidently deleted /var/vm, stuck on grey screen with apple logo.

I deleted the entire vm folder and now my MacBook Pro won't get beyond the grey screen with the apple logo. I don't have any recovery discs with me. What can I do to rescue my MacBook Pro?


Thanks in advance.

MacBook Pro, Mac OS X (10.7)

Posted on Apr 9, 2012 10:17 AM

Reply
13 replies

Apr 9, 2012 10:22 AM in response to tenorish

Since you are running OS X Lion you can reinstall the OS using the Recovery HD volume. Reboot with Command-R held down to get to the recovery tools, and then select the option to reinstall OS X. This will take a while since the tools have to download ~3-4GB of installer files from apple, but will replace the missing components.


The second option is to restore from a recent Time Machine backup, if you have one, which would also be done through the Recover HD volume's tools. This is the faster of the two options, but will require you have a recent and complete Time Machine backup available.

Apr 9, 2012 10:29 AM in response to macjack

I just checked and sure enough, /var/vm is backed up by TM

I am not sure this will help the OP, but if I use Go in the Finder and select /var and then run TM, I can see all the directories including vm.


I presume with TM connected one could simply restore the vm file rather than restore the entire OS, providing the restore allows this kind of selective repair.


Booting into a terminal and copying /var/vm back where it belongs might be all that is necessary.

Apr 9, 2012 10:40 AM in response to nerowolfe

Very true, you could enable the Finder to show hidden files and then restore just the vm folder with that.


The /var/vm folder is just used to store the sleep image and swap file for OS X, so you should be able to simply recreate it using the Terminal in the Recovery HD partition, and not have to deal with reinstalling or restoring.


To do this, select Terminal from the Utilities menu in the OS X Tools interface (when you boot to the Recovery HD partition). Then enter the following commands:


mount -uw /Volumes/Macintosh\ HD/


mkdir /Volumes/Macintosh\ HD/var/vm


After doing this, use Disk Utility to repair permissions, and then restarting should have OS X use the folder for the sleep image and swap files.


Message was edited by: Topher Kessler

Apr 9, 2012 11:38 AM in response to tenorish

Hmm...this means your system does contain the /var/vm folder, so the problem is not because it is missing.


As for the permissions repair, you can try doing it using the Terminal in the Recoverh HD volume with the following command:


diskutil repairPermissions /Volumes/Macintosh\ HD/


If this does not work, then something else besides the configuration of the /var/vm folder is the cause of the problem here, and you would likely address it fastest by reinstalling OS X.

Apr 9, 2012 12:18 PM in response to tenorish

It looks like you hosed your system. If the permissions database is gone then when you ran whatever procedure that had you thinking you deleted the /var/vm folder, then you might have inadvertently erased a number of other files. While you might be able to restore them through meticulous work with the Terminal, a simple reinstall will repair the damage done.


Reinstalling will not wipe your disk, but instead will overwrite and replace system files on the drive. Your applications, user accounts, settings, and data will all be left alone, and the OS will be refreshed underneath it.

Apr 9, 2012 12:48 PM in response to Topher Kessler

Yes, I might have deleted other files too while I was trying to free up some disk space.

The problem is that I presently don't have access to the apple ID which I used to install Lion, so I cannot go that route.


When I try to start it in safe mode I get: launch_msg(): socket is not connected.


Does that mean anything? Is there any way I can restore whatever missing files there are through terminal?


Thanks again!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Accidently deleted /var/vm, stuck on grey screen with apple logo.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.