taming Versions…sort of



If you’re working with large files in Keynote, Pages, Numbers or other Versions-supported programs, and making multiple changes at regular intervals, Versions could just be eating up your hard disk and causing a big-slow down in your work.

If you want to reclaim all that space and speed things back up, go delete the .documentrevisions-V100 folder in the root directory of your hard disk, the place where Lion stores all your document versions. Be aware that this means you will lose ALL Version history for ALL your Version-supported applications. If you are comfortable with that, read on…

You need to do four things: enable the root user, show hidden files, change the permissions on the folder and finally check the folder’s contents and delete it. Here’s how:

1. Show hidden files
In Terminal (Applications > Utilities) type

defaults write com.apple.finder AppleShowAllFiles YES
Press ‘Return’, then type
killall Finder

2. Enable root user
Go to  > System Preferences…Users & Groups
Click ‘Login Options’
Click ‘Network Account Server: Join’
In the resulting dialogue box, ignore the text input and click the button below, ‘Open Directory Utility’
Click the padlock at the bottom of the next box and enter your admin password.
At the top menu bar of Directory Utility, choose the ‘Edit’ menu > Enable Root User
If you are requested to set a password for it, set the same one as your Admin password (this ensures you won’t forget it).
Log out through  > Log out (username), then log back in with user ‘root’ and the password you just enabled.

3. Change Permissions
Now go look in the root directory of your hard disk.
You should see a greyed out folder called ‘DocumentRevisions-V100’. If it has a ‘no entry’ icon on it, click the folder and press ‘Cmd-i’ on the keyboard (or right click the folder and choose ‘Get info’).
Scroll down to the bottom of the box, click the padlock, and enter your root password if necessary. Change all the permissions to ‘read & write’, and click on the ‘gear wheel/cog’ and choose ‘Apply to enclosed items’ if it appears.
Choose ‘OK’ in the warning dialogue box.

4. Deleting Versions history
Now you are ready to go and look inside the Versions directory. I recommend you have a nosey about and check the file sizes both of the folder itself and of the individual contents. Now, here’s a warning: you can’t just delete some of the contents in the folder. If you do, in about 24hrs Lion will see that the folder is corrupt and mark the whole thing as ‘bad’ and make a new Versions (.DocumentRevisions-V100) folder. What this means is that you will lose access to Versions in the UI, but you won’t get your disk space back as it won’t delete the ‘bad’ folder.

The only option is to either lock the thing back up and leave it alone, OR delete the entire .DocumentRevisions-V100 folder with all its contents.

Restart your computer logging in as your usual user.

Lion will make a new, empty DocumentRevisions-V100 folder to replace the one you deleted and start filling it up with versions you make from then on. You’ll have reclaimed your disk space (and removed all your previous versions), but you’ll need to keep doing the same process at regular intervals.

NOTES
a. No, this does not affect your original saves or any duplicates. Only the versions.

b. Messing about as a root user can have serious consequences if you mess with other stuff. Do as the instructions say and nothing else unless you know what you’re doing. After you’ve deleted the Versions folder and emptied the Trash, go back to Directory Utility > Edit and disable the root user.

c. To stop seeing the hidden files, type the same command as given in 1. above into Terminal, but change ‘YES’ to ‘NO’. Don’t forget to do the ‘killall’ command afterwards.

d. If you have trouble saving documents without re-booting after deleting .DocumentRevisions-V100, try this script from Apple Discussions user Yvan. This will recreate a clean (i.e., empty) Versions folder every time you reboot, saving you the hassle of regularly cleaning out the .DocumentRevision-V100 folder (as well as preventing any ‘Save’ issues.)

Advertisement

About philastokes

Independent Software Developer, Technical Writer and Researcher at SentinelOne. Explaining the unexplainable with images, video and text. Scripting anything imaginable in AppleScript, Bash, Python and Swift.

Posted on September 16, 2011, in OS X Lion and tagged , , , , , , , . Bookmark the permalink. 12 Comments.

  1. Dude, you are a HEROOOO.
    Was getting “out of disk space” over and over on a Macbook 128GB, and with no music, not much else, could not figure it out. Well, I have a 237MB journal that I write on every day, Pages app, and guess what, that was creating massive hidden versions. Found DaisyDuke which discovered the 50GB! of versions, found you, and shazammmm. I went from a full 128GB lappy to a 59GB available lappy. I am not at all a tech guy, but this 59GB makes me feel so so so happy. Super stoked super thanks. – AB in Santa Barbara

  2. Sorry that I ask here but how do I complain to Apple that Versions feature sucks? At the Apple support site there is only a stupid ExpressLane that suggests I phone them.

  3. Renard DellaFave

    “sudo rm -r /.DocumentRevisions-V100” is sufficient. Worked for me without changing any permissions. Now I just need to script it to run every 12 or 24 hours and I’ll be all set. Thanks Apple, really needed the unnecessary complication…

    • Interesting…sudo didn’t work when I tried it (that was my first attempt at getting rid of DocumentRevisions), which is why I worked out the procedure above.

      In any case, if it works for you, that’s all good! 🙂

  4. Hi, I don’t use GraphicConverter but a quick websearch showed that release 7.3.1 has the option to turn off Autosave and Versions. Have you updated to that release and tried turning off Autosave?

  5. Hmm…. was editing a tiny 1 kb icon for my application. Suddenly I noticed that the icon was now 25 kb. I thought this was Versions. If not what was it? I used GraphicConverter so it can’t have been Photohop or Fireworks layers. Need to try this again.

  6. Both the procedure described here and the script linked to seem like a truckload of work. Can’t you just do this?

    sudo rm -rf /.DocumentRevisions-V100

    Also, what happens if you make that directory read-only? Do autosave “enabled,” applications detect this as an issue (mark the directory as “bad”) and start over in a new directory, or will it just fail silently forever?

    I’m not even really concerned with whether autosave is keeping some extra crap in one directory on my local drive, though I can see how it would be a problem for people who work with a lot of images or something. My greater concern is where the Apple help page states that, “Auto Save in OS X Lion adds the changes directly into the file so there’s only one copy of the document on your Mac.” Even though the “versions,” themselves aren’t included in the file, I wonder how much extraneous metadata is being injected, what it includes, and how long it will take someone to find a way to exploit that data?

    • Hi Mike,

      no that won’t work. If you lock the directory or delete it, Lion will just make a new one (perhaps not right away; it may wait for the 24hr Versions backup cycle to come round). Yes, it will mark a locked directory as ‘bad’.

      The sudo force delete command will not remove the DocumentRevisions-V100 folder. Not even root has the power to delete it until you change the permissions.

      I don’t think you need to worry about metadata in the file, or the possibility previous edits can be retrieved from the file itself. As I understand it, it doesn’t work like that. I think the line you quoted is trying to say that there are not multiple full copies of the file (as happens in say, MS Word backup copies). Rather, there’s just the latest version in your normal Folders, and all the ‘changes’ are stored in DocumentRevisions. If you make a Duplicate (similar to the old ‘save as…’ command), none of the version history goes with the document.

      • James Stradling

        Actually, this does work. Using sudo can delete *anything* on the system, including the hidden versions file. Just use the sudo command mentioned above by mike, restart, edit a file in an app that supports Versions, and you’re set.

  7. This is much too complicated. And not really effective.

    • Hence the ‘sort of’ in the title. 😉

      But yes, I agree its complicated — you’ll have to lay the blame for that at Apple’s door I’m afraid. They made it complicated to remove, not me! They don’t want people tampering with Versions and have buried it deep into the heart of the OS.

      That’s also why the procedure above is not entirely effective. You can’t stop Versions-enabled programmes from trying to save Versions. We can only hope that Apple will add this as an option at some time in the future ( which they might if enough people complain that they don’t like it…. 😉 ).

      Nor can you stop Lion re-creating the DocumentRevisions folder automatically after 24 hours; as far as I know at the moment, there is no way to turn that off. That means the procedure above needs to be repeated. However, please see Note d. at the end and the link to Yvan’s script. This makes the deletion of the DocumentRevisions folder automatic, every time you reboot in fact.

      I’m sorry if this isn’t an entirely satisfying answer (plenty of us are frustrated with this ‘feature’!), but I’m afraid it’s the best one we’ve got for the time being.

%d bloggers like this: