Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Jasper1990

macrumors newbie
Original poster
Jul 7, 2014
9
0
I needed help! I made one of the dumbest mistake. I deleted the private folder file /var. it is still sitting in my trash. I restarted my computer now It's stuck in a grey screen. Can I still restore the private file back without without an installer cd? Or just using the terminal?

I have a MacBook Pro 13, (mid 2012) running lion OS X.

Please help.
Quote Edit
 

chrfr

macrumors G5
Jul 11, 2009
13,535
7,056
I needed help! I made one of the dumbest mistake. I deleted the private folder file /var. it is still sitting in my trash. I restarted my computer now It's stuck in a grey screen. Can I still restore the private file back without without an installer cd? Or just using the terminal?

I have a MacBook Pro 13, (mid 2012) running lion OS X.

Please help.
Quote Edit

Start the computer from the Recovery Partition (command-R at startup) and choose the install OS X option to reinstall Lion. It will reinstall the system files you deleted but won't overwrite your files.
 

Jasper1990

macrumors newbie
Original poster
Jul 7, 2014
9
0
Thanks for replying sir!

I tried it last night! But it says 2,9494733 hours left! Somethin like that! Is that normal? It is taking soo long!

My computer specs is, i7, 8gb ram. 2.9 ghz
 

chrfr

macrumors G5
Jul 11, 2009
13,535
7,056
Thanks for replying sir!

I tried it last night! But it says 2,9494733 hours left! Somethin like that! Is that normal? It is taking soo long!

My computer specs is, i7, 8gb ram. 2.9 ghz

It has to download the operating system from Apple, so the time it takes is dependent on your internet connection speed.
 

Jasper1990

macrumors newbie
Original poster
Jul 7, 2014
9
0
Oh okay. I think my internet is pretty decent here. :(

Hmm. Do you know how I can bring back the private folder from the trash back to the original place using a terminal?
 

0000757

macrumors 68040
Dec 16, 2011
3,894
850
Oh okay. I think my internet is pretty decent here. :(

Hmm. Do you know how I can bring back the private folder from the trash back to the original place using a terminal?

Question, how did you manage to delete the vars folder? :confused:

As for restoring via terminal, I know there is a way to restore files but I believe you have to actually be logged in as that user, but here are instructions I found on Google that may help. You can always try.

If you have another computer you can access that can read the Mac OS File structure, you may be able to plug your hard drive in and restore it manually as well, but that's very tricky and not guaranteed.

Otherwise I'd just wait for the download to finish and reinstall. You might want to go to a place with ethernet connections like a library. For me when I had to reinstall Lion it took about 30-40 minutes to download the installer on my internet connection.
 

Intell

macrumors P6
Jan 24, 2010
18,955
509
Inside
Even if you do manually restore the critical /var/ folder, you'll never fix all the permissions in it. Even Disk Utility won't fix them all correctly.
 

Intell

macrumors P6
Jan 24, 2010
18,955
509
Inside
Do the reinstall as suggested by chrfr above. That should fix the problem and allow you to recover your files.
 

Intell

macrumors P6
Jan 24, 2010
18,955
509
Inside
Do what is suggested in post #2. Trying to restore the /var/ folder via the Terminal will cause problems as the permissions will be incorrect.
 

Intell

macrumors P6
Jan 24, 2010
18,955
509
Inside
chmod -R 755 and chown -R root:wheel for the folder wouldn't work?

That would cover most of them, but there are some other critical ones have have special permissions that will cause problems if they don't have the exact correct permissions.
 

BR3W

macrumors 6502
Sep 22, 2010
318
46
If you can get access to your system, either through safe mode or booting up with a time machine backup or another operating system, you can simply use the move command to put the folder back where it belongs. Permissions shouldn't be affected and not sure why people are suggesting they would be.
 

Jasper1990

macrumors newbie
Original poster
Jul 7, 2014
9
0
I actually with all the hard work restored it back through the terminal and now my Mac is working but now Some apps are not working properly! :( I guess I needed to re install the OS. What I'm really after is the files in my hard drive. :(
 

Chad3eleven

macrumors regular
Dec 11, 2012
144
0
So you fixed it?

You said you fixed it via terminal, and your mac is working, but you really want the files from your harddrive.

whats stopping you from doing this?

Also, you can/could hookup your mac to a different mac and access your files.
 

Jasper1990

macrumors newbie
Original poster
Jul 7, 2014
9
0
Because when I rebooted it and tried to log in, I can't go back to my Mac and now stuck in the log in section . Tried to do the classic hack (applesetupdone) for the users but it doesn't help like I made three accounts already but won't let me in.

How do I get my files using another computer?
 

Intell

macrumors P6
Jan 24, 2010
18,955
509
Inside
You're having problems because your permissions are messed up. The mv command won't be enough to properly correct it and will result in permissions problems because of how Finder treats the Trash. Things that go in there get quasi-user permissions that can only be corrected by the Finder. Because you get get to the Finder, you can't properly restore that folder without permissions problems.
 

Jasper1990

macrumors newbie
Original poster
Jul 7, 2014
9
0
Yes I did follow it but I don't know I've tried many times! It says,
About -2147483648 hours remaining.. What the heck is that? My internet is pretty decent but why that long? Is it still because of the var file deletion?
 

Jasper1990

macrumors newbie
Original poster
Jul 7, 2014
9
0
Planning to boot it with a re bootable OS In a flash disk.

My friend told me "Boot from flash drive, divide your hard drive into two partition, copy files to second partition. Then after that reformat first partition. " because I don't have an external with me. I'm currently traveling :(
 

BR3W

macrumors 6502
Sep 22, 2010
318
46
If /var has the wrong permissions set then correct that problem rather than partitioning, reinstalling, etc. first step is to try and fix permissions through disk utility. Then open terminal and fix /var owner. I don't have my MacBook with me, but you can check if it's wrong by doing: ls -la and seeing who the owner is. If it's your user name then change it by: sudo chown -R root /var
 

Intell

macrumors P6
Jan 24, 2010
18,955
509
Inside
If /var has the wrong permissions set then correct that problem rather than partitioning, reinstalling, etc. first step is to try and fix permissions through disk utility. Then open terminal and fix /var owner. I don't have my MacBook with me, but you can check if it's wrong by doing: ls -la and seeing who the owner is. If it's your user name then change it by: sudo chown -R root /var

Disk Utility cannot correctly fix all the permissions in /var/. Not all of the permissions in /var/ are root:wheel or 755. Some belong to the mail, sys, daemon, or _amavisd group. Most are executable, some are not. A few are read only, some are read/write.
 

BR3W

macrumors 6502
Sep 22, 2010
318
46
It should only have changed the ownership, not the rest. Using disk utility and changing ownership back to root will get his system running enough to get his files, which is what he said he needs to do while on the road.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.