How to Delete a Locked File On My Macbook?

50

I installed a program on my Mac that I now want to remove. But when I try to drag it to the trash I get a item is locked error. What the heck? How can I remove it?

Like all modern operating systems, your Mac has a sophisticated model for managing files and applications. One of the most important features is what's getting in your way; making sure that the wrong files aren't accidentally  or deliberately “ removed or changed. You can imagine a hacker sneaking onto your computer, changing some of the key system files (like the change password utility!) and causing quite a problem with your system.

Administrative programs and utilities can not only be locked down with permissions, though, they can also be hidden and not show up in the Finder without extra work. Even in Terminal, it can require expert knowledge to show absolutely everything on your Mac system. And thats all for your protection, believe it or not.

Now with the situation you're seeing, there are some programs like antivirus apps and backup programs that lock themselves in place and then pour digital concrete around them to really ensure that no other program can sneakily replace them. And it can be a pain to delete em.

So your first step is to check with the vendor: do they have an uninstall program? If they do, use that.

If not, well, lets try some things

 

First off, since CrashPlan is shutting down and Ive switched my cloud backup to the faster and less expensive iDrive anyway, lets get rid of CrashPlan on my own Mac system. A click to Trash the app and heres what I see:

Okay. No panic. First step is to have a closer look, which can be done by choosing the app then using the Command-I Get Info shortcut to get this window:

Can you see the fourth checkbox right in the middle of the info window? Locked. But not only is it checked, its greyed out. This is pretty secure! One thing you can try is opening up the Sharing & Permissions pane and clicking on the padlock to unlock access:

You can see the padlock above. Usually the first entry is something like (Me) which means you could unlock the file or folder (remember, Mac apps are really folders) then grant yourself read & write, then uncheck the locked box. But not in this case. Sooo¦ its time to open up the Terminal and type commands in directly.

You'll find the Terminal app in Applications > Utilities and its a good program to know as it can be quite useful [and fun: Check out my top rated book Learning Unix for MacOS X from Reilly]. For now, the few commands youll need are  to change directories to where the app, file or folder can be found, chflags to change that darn locked flag, then rm to remove the program or file. Oh, and sudo to convince the Mac to let you change those permissions in the first place.

In this case, I know /Applications is the command line equivalent of the top-level Applications folder, so here are exactly the commands I used to move to the CrashPlan app, unlock it, and remove the entire package:

Be careful, particularly with that last command, because theres no backing up, no undo, no changing your mind. But thats how you remove a file, folder or program that just refuses to be removed. Because, hey, its your darn computer, right? ?

Comments are closed.

Join 30,000 Bloggers
AND GET OUR LATEST CONTENT IN YOUR INBOX

SUBSCRIBE 
Your information will never be shared
close-link