Need help with deleting files from MacBook
June 7, 2012 10:39 AM   Subscribe

How do I delete large amount of files off a MacBook?

I have about 50GB of space left on my hard drive. I'd like to clean it up and delete some large files. All this this is getting backed up to my external, but I'm running into an issue with my trash crashing every time I try to 'empty securely'. I'm obviously not doing this the correct way and google doesn't seem to help me pinpoint what I want to do in the easiest instructions.

BTW, trying to delete somewhere around 6000+ files all sitting in my trash basket. Eek!
posted by melizabeth to Computers & Internet (13 answers total) 1 user marked this as a favorite
 
Are you familiar with using Terminal at all? It's an application in your Utilities folder that lets you run commands by typing them in. The command to enter in Terminal would be:
rm -rf ~/.Trash/*
Hopefully someone else will come along to confirm that that's the exact wording but unless my brain is malfunctioning I think it's right.

If you're not comfortable doing this (after all, it's pretty similar to the command that accidentally deleted Toy Story II from Pixar's server, oops) you could also just move some of the files out to a folder on your desktop and delete them in batches a few hundred at a time.
posted by bcwinters at 10:50 AM on June 7, 2012 [1 favorite]


The simplest way, I think, would be to do a standard "Empty Trash", then use Disk Utility to wipe the free space. But given that you're running into issues that may also arise with that method, it's probably worth following bcwinters' advice: start by clearing out small batches, then increase the size.
posted by holgate at 10:56 AM on June 7, 2012


bcwinters has the right idea. If you want to secure delete the files, add the -P parameter:

rm -Prf ~/.Trash/*

This overwrites the files 3 times, according to the manpage. I'm not sure if this is exactly equivalent to "Secure Empty Trash" or not.

If you get "Permission denied" errors, add a "sudo" to the front of the command line and you'll be prompted for the admin password. Be extremely careful with this, as it could hose your entire system if you enter it wrong. (If you enter it wrong without sudo, you could hose your user account and probably your Applications/Library, but OS X itself would probably be okay.)
posted by neckro23 at 10:58 AM on June 7, 2012


If you enter it wrong without sudo, you could hose your user account and probably your Applications/Library, but OS X itself would probably be okay.

I always think this is funny when talking about the security implications of running as admin -- without admin rights you can only delete all the stuff you care about. With admin rights you can also delete a bunch of easily restored stuff that comes on the OS disk.
posted by tylerkaraszewski at 11:01 AM on June 7, 2012 [7 favorites]


Do you have access to another Mac? If so, you could connect them via Firewire and boot your MacBook in target mode (by pressing the "T" button when you turn the computer on.) Your MacBook will appear on the other Mac as an external drive.

In will be easier to delete large amounts of data of your MacBook's drive when the drive isn't also being used to run the OS.

I would also advise using holgate's suggestion of deleting insecurely and then zeroing out the the free space with disk utility.
posted by patnasty at 11:02 AM on June 7, 2012


There is a Service called "Delete Immediately" that adds a line to your context menu that deletes files... well, immediately. It says he created it for Snow Leopard, but I have no problems with it in Lion. It's a bit fiddly to install, but if you follow his instructions it's not that hard.
posted by Rock Steady at 11:04 AM on June 7, 2012


I think you may be misunderstanding what "empty securely" means. It's quite normal that securely deleting a large number of files takes a long time.

When you "delete" a file from your hard drive, it doesn't actually erase it; it just unlinks it - the handle to the file is removed, and the places on the hard drive that the file had occupied is now marked as reusable by other things. This has fantastic performance characteristics - it's really fast to do it like this - but the tradeoff is that the contents of the file are still on the hard drive, even if you can't get to the anymore. The OS considers it to be free space, and eventually it will get reused by something, but for the moment the information is still there but hidden.

"empty securely", though, means that before the file is unlinked, the sectors on the drive containing those files are zeroed first - that is, the files are overwritten with zeros, and the data is now guaranteed gone instead of just having the space where it was marked as being reusable. That means that your computer has to actually overwrite the contents of all six thousand plus of your files, which could take a long time.

Where the word "securely" comes in is that, in the first scenario, somebody who wants that data you've just deleted can steal your hard drive, do a sector-by-sector scan of it and maybe recover some portion of it, which you may not want. If the files were securely deleted, though, the deleted information is gone for real - that's what "securely" means you're being protected from.

If you don't feel like that's a real threat in your life - and bear in mind these would have to be people with desire and ability to do forensic data recovery on your hard drive, but wouldn't be inclined just to interrogate you for that information directly, so basically if these aren't corporate records you're deleting and you don't foresee a lawsuit or law enforcement involved in your life - then just use "empty trash", not "Secure empty trash".

From your perspective they'll do the same thing, but one will be much, much faster.
posted by mhoye at 11:12 AM on June 7, 2012 [3 favorites]


Oh, and don't do any of that command-line stuff mentioned above, you're one mistyped character away from a serious disaster if you go down that path.
posted by mhoye at 11:13 AM on June 7, 2012 [1 favorite]


Oh, and don't do any of that command-line stuff mentioned above, you're one mistyped character away from a serious disaster if you go down that path.

Yes. No matter how well-meaning and well-intentioned command line advice is on the internet, I never, ever copy and paste a command I found somewhere. I'm not suggesting the users above are trying to mess with you, I'm just saying that if you find a command on the internet, you then need to read the manpage for that command and see that the options being passed to the command are doing what you expect them to.
posted by King Bee at 11:26 AM on June 7, 2012


mhoye: don't do any of that command-line stuff mentioned above, you're one mistyped character away from a serious disaster...

This is true, and so is this:

tylerkaraszewski: without admin rights you can only delete all the stuff you care about. With admin rights you can also delete a bunch of easily restored stuff that comes on the OS disk.

(So, so true.)
But that's no reason to dismiss the Terminal and the command line.

All you're saying is "remove (rm) recursively (-r) all the files (*) in the special folder called Trash (.Trash/) that is in my home folder (~/). Oh, and I really mean it - force the issue if needed (-f). So that works out to saying: rm -rf ~/.Trash/*

But mhoye is absolutely right: if you put in a space between ~/ and .Trash/, for example, you'll be executing "rm -rf ~/" which deletes everything in your home folder, and then it will tell you that it couldn't find a folder called .Trash (because well, it just deleted everything).

Most unix old hands have heart-stopping moments related to "rm -rf", so use it with caution and check twice. But it is a very efficient way to get things done.
posted by RedOrGreen at 11:53 AM on June 7, 2012 [1 favorite]


Yeah. Don't do a Secure Empty Trash unless you really have a good reason to want to be sure that someone using special software can't attempt to recover some of the data. Since you already have these files backed up on your external drive, your adversary could just search that drive if they wanted to get at your secrets. If you're content with the security of the files sitting on your external, you can be perfectly content with the security of doing a regular Empty Trash on them now.
posted by zachlipton at 12:37 PM on June 7, 2012


I think we have gotten hung up on the "secure delete" part of this question and I think the OP needs some advice about how to prioritize the clean up operation. I have found the Disk Inventory X tool to be invaluable in providing a visual inventory of what occupies space on your hard drive. It doesn't delete files for you, but you might find that you have a bit of space taken up in places that surprise you.

If you use only one language, search for de-localization tools that remove extra language files. Some of these also remove binaries for the older PowerPC platform back when universal binaries (which really just meant two executables) were often delivered.

Finally, I agree with others to do a normal delete. If for some reason you can only do secure delete it is because your user account was set up this way on the machine. It can be changed with the admin password in the user account system control.
posted by dgran at 1:36 PM on June 7, 2012


You shouldn't be crashing on empty trash. You really shouldn't be. I'd tread with caution. Are you sure you have backups? Do you have two? If you can't manage that, at least copy the most important stuff off onto a flash drive before you start invoking 'rm' from the command line.

If I had crashes on empty trash and I was sure I had my two backups, I'd start with a boot to the repair partition (Snow Leopard and up) and first run a repair permissions and a repair disk before I did anything else. Once those were happy I'd finally run the empty trash again.

If that works and I genuinely had stuff that required secure erasing, I would then do that from Disk Utility.

tylerkaraszewski: "I always think this is funny when talking about the security implications of running as admin -- without admin rights you can only delete all the stuff you care about. With admin rights you can also delete a bunch of easily restored stuff that comes on the OS disk."

Oh, that's only funny on single user systems. On multi user system, which the mac is, admin's can delete everyone's data. Admin access isn't so much about protecting the OS. It's about protecting Bob in accounting who runs the payroll.
posted by chairface at 7:40 PM on June 10, 2012


« Older Resale value of iMac?   |   keep me away from this crazy Newer »
This thread is closed to new comments.