I accidentally moved my /var folder to trash and now unable to login to Mac. The only solution I found until now is to recover OS X.

I have tried to move /var back to /private folder in single user mode, since it is read-only and not allowing me to perform this action.

Is there any way I can move /var back without re-installing OS X? I am having Mavericks as OS.

  • Are you using OS X or Linux? That makes quite a difference...
    – l0b0
    Nov 21, 2014 at 16:37
  • My bad,actually It should be tagged under Unix.
    – Sajjad
    Nov 21, 2014 at 16:40
  • Unix is a third alternative. Which OS are you using? Try running uname -a in a shell and adding the result in your question.
    – l0b0
    Nov 21, 2014 at 16:41
  • I am using OS X mavericks mentioned in actual question.
    – Sajjad
    Nov 21, 2014 at 16:42
  • Do you keep a time machine backup? If so, hold down your Command Key and the Letter R at bootup to start your Recovery Process, then restore a time machine backup that includes /var See Support: About OSX Recovery
    – eyoung100
    Nov 21, 2014 at 17:31

2 Answers 2


You'll need to repair your OS X installation. You can do this without destroying data on your Mac. This post from Apple Discussions explains it well:

Do the following:

  1. Repair the Hard Drive and Permissions

Boot from your Snow Leopard Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Utilities menu. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list. In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive. If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer.

If DU reports errors it cannot fix, then you will need Disk Warrior and/or Tech Tool Pro to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.

  1. Reinstall Snow Leopard

If the drive is OK then quit DU and return to the installer. Proceed with reinstalling OS X. Note that the Snow Leopard installer will not erase your drive or disturb your files. After installing a fresh copy of OS X the installer will move your Home folder, third-party applications, support items, and network preferences into the newly installed system.

These instructions were for Snow Leopard, but the same formula will apply for Mavericks. You'll need bootable installation media--Mavericks doesn't come on CD/DVD, so you'll need to make bootable installation media, but examples of how to do this are online, including official instructions from Apple.


Since you said you had trouble due to the system being read-only in single-user-mode, boot to single-user-mode, and do

mount -uw /

This will make your disk non-read-only, but you will have to do it again if you boot into single-user-mode again. Then try moving the var folder into the /private folder, and make a link to it using

link -s /private/var /var

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .