You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Can't delete a file from trash.

Hello,


So I am trying to delete “Install macOS High Sierra” file from trash, but whenever I try to delete I get the following error "The operation can’t be completed because the item “Install macOS High Sierra” is in use."


Tried running various commands through terminal.


Any help would be appreciated because it is eating 5 GB.

MacBook Air (13-inch, Early 2015), macOS Mojave (10.14)

Posted on Sep 24, 2018 10:01 PM

Reply
Question marked as Top-ranking reply

Posted on Sep 27, 2018 11:28 AM

Alright, I have some steps you can take that should get this resolved.


(In all the instructions below, tick marks ( ` ) indicate what to type. You don't need to type the ` characters.)


First, move the file somewhere easy to get to on your computer, like your home folder.


Shut down your computer, and then while turning it on, hold command + r to boot into recovery mode (Instructions here: https://support.apple.com/en-us/HT201314)

Hold down Command-R or one of the other macOS Recovery key combinations on your keyboard immediately after pressing the power button to turn on your Mac, or immediately after your Mac begins to restart. Continue holding until you see the Apple logo or a spinning globe. Startup is complete when you see the utilities window:


When you reach the recovery page, in the Utilities menu select terminal.


Type `diskutil list`


Find the disk that is your computer's main hard drive. On most Macs, it is called Macintosh HD. Here is part of the output from my computer. Yours may look different, but the important thing is the Macintosh HD.


/dev/disk1 (synthesized):

#: TYPE NAME SIZE IDENTIFIER

0: APFS Container Scheme - +1.0 TB disk1

Physical Store disk0s2

1: APFS Volume Macintosh HD 524.9 GB disk1s1

2: APFS Volume Preboot 76.9 MB disk1s2

3: APFS Volume Recovery 1.0 GB disk1s3

4: APFS Volume VM 1.1 GB disk1s4


The identifier for the volume Macintosh HD in this example is `disk1s1`. I will use <identifier> as a placeholder in the subsequent instructions.


Type `diskutil mount <identifier>`

(If you receive a message saying that it may be locked, use the command it gives you, adding <identifier> to the end as in the above command.)

After it has mounted:


Type `cd /Volumes`

Type `ls`


You should see the name of your disk (Macintosh HD) along with one or two other things.


Type `cd "Macintosh HD"` (replace Macintosh HD with the name of your disk if it's different). Make sure to include the quotes.


At this point you are now in your hard drive. You can use `ls` to see what's in the current directory and `cd "<folder name>"` to navigate to the location of the file. Use `cd ..` (two periods) to navigate back up to the previous folder.


For example, if you left the file in your home directory, you would type:


`cd "Users"`

`cd "<your username>"`


You can use `ls` at any point to see what's available.


Use the command `rm -rf "<filename>"` as before, once you have reached the folder where it is located. Verify you have found it by using `ls` to see that it is there. Be careful as it will delete anything you tell it to.


When finished, close the terminal window and use the Apple menu to restart.


I hope these instructions are clear, let me know if I need to explain something better.

Similar questions

12 replies
Question marked as Top-ranking reply

Sep 27, 2018 11:28 AM in response to SagarKhanapurkar

Alright, I have some steps you can take that should get this resolved.


(In all the instructions below, tick marks ( ` ) indicate what to type. You don't need to type the ` characters.)


First, move the file somewhere easy to get to on your computer, like your home folder.


Shut down your computer, and then while turning it on, hold command + r to boot into recovery mode (Instructions here: https://support.apple.com/en-us/HT201314)

Hold down Command-R or one of the other macOS Recovery key combinations on your keyboard immediately after pressing the power button to turn on your Mac, or immediately after your Mac begins to restart. Continue holding until you see the Apple logo or a spinning globe. Startup is complete when you see the utilities window:


When you reach the recovery page, in the Utilities menu select terminal.


Type `diskutil list`


Find the disk that is your computer's main hard drive. On most Macs, it is called Macintosh HD. Here is part of the output from my computer. Yours may look different, but the important thing is the Macintosh HD.


/dev/disk1 (synthesized):

#: TYPE NAME SIZE IDENTIFIER

0: APFS Container Scheme - +1.0 TB disk1

Physical Store disk0s2

1: APFS Volume Macintosh HD 524.9 GB disk1s1

2: APFS Volume Preboot 76.9 MB disk1s2

3: APFS Volume Recovery 1.0 GB disk1s3

4: APFS Volume VM 1.1 GB disk1s4


The identifier for the volume Macintosh HD in this example is `disk1s1`. I will use <identifier> as a placeholder in the subsequent instructions.


Type `diskutil mount <identifier>`

(If you receive a message saying that it may be locked, use the command it gives you, adding <identifier> to the end as in the above command.)

After it has mounted:


Type `cd /Volumes`

Type `ls`


You should see the name of your disk (Macintosh HD) along with one or two other things.


Type `cd "Macintosh HD"` (replace Macintosh HD with the name of your disk if it's different). Make sure to include the quotes.


At this point you are now in your hard drive. You can use `ls` to see what's in the current directory and `cd "<folder name>"` to navigate to the location of the file. Use `cd ..` (two periods) to navigate back up to the previous folder.


For example, if you left the file in your home directory, you would type:


`cd "Users"`

`cd "<your username>"`


You can use `ls` at any point to see what's available.


Use the command `rm -rf "<filename>"` as before, once you have reached the folder where it is located. Verify you have found it by using `ls` to see that it is there. Be careful as it will delete anything you tell it to.


When finished, close the terminal window and use the Apple menu to restart.


I hope these instructions are clear, let me know if I need to explain something better.

Sep 24, 2018 10:22 PM in response to SagarKhanapurkar

If you are unable to delete it, even after restarting, you can use the command line. If you are unfamiliar, be warned that you must type exactly what is shown here:


Open Terminal.app (In Applications > Utilities)

Type the following line and press enter (or copy and paste it):


sudo rm -rf .Trash/


Enter your password and press enter. It will not show that you are typing.

Sep 24, 2018 10:48 PM in response to crazy person

Sure. Here it is


Sagars-MacBook-Air:~ sagarkhanapurkar$ sudo rm -rf .Trash/

Password:

rm: .Trash//Install macOS High Sierra.app/Contents/SharedSupport/InstallESD.dmg: Operation not permitted

rm: .Trash//Install macOS High Sierra.app/Contents/SharedSupport: Directory not empty

rm: .Trash//Install macOS High Sierra.app/Contents: Directory not empty

rm: .Trash//Install macOS High Sierra.app: Directory not empty

rm: .Trash/: Directory not empty

Sep 25, 2018 1:10 AM in response to SagarKhanapurkar

Hi,


The link I have provided is to a website that tells you how to empty the trash and create a new trash folder


Before you start be sure to have a good up-to-date backup (preferably two different backups on two different drives)


http://www.thexlab.com/faqs/trash.html#Anchor-Empty-49575


If nothing works or you feel uncomfortable with the procedure on the the X labs website call apple support back and they will help you sort the problem out

Hope that helps, have a nice day

Can't delete a file from trash.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.