A few days ago, I wrote about a nasty bug in that can bring the system to its knees, requiring a force kill of or a logout or reboot. That page has now been updated with command line alternatives that make it instant to terminate the offending processes.
Apple Mail fails to close files too
Apple Mail has bugs in failing to close open files as well: send an image in an email, then put the file in the trash. Even hours after the email has been sent, the file(s) may remain open, so the Trash cannot be emptied. Strangely, this did/does not happen when tested with 120 images in an email. So it’s a behavior that apparently depends on something.
Here is how to see open jpg files in Apple Mail (in Terminal). These two files are in the trash. Mail has long since sent the message, but it has failed to close the files, so attempting to empty the trash produces an error alert for every such open file—quite a nuisance over the course of the day. But in this case the solution is simple: quit Apple Mail and the files get closed. While only a nuisance since there is an easy workaround, it is yet more Apple Core Rot.
diglloydMP:DIGLLOYD lloyd$ lsof | grep Mail | grep jpg
Mail 23447 lloyd txt 885100 23720017 /Users/lloyd/.Trash/Sony28_135.jpg
Mail 23447 lloyd txt 889332 23720381 /Users/lloyd/.Trash/2-frame-f13.jpg
Ghost applications keeping files open
The case of “ghost applications” seems to be a feature, not a bug, that is, in the ghastly way Apple fails to consider side effects and implications that make the alleged benefits to some a bitter brew for others.
Chris K writes:
Not just files, but programs. I have noticed this problem for the last couple iterations of OS X. It seems all Apple programs themselves (Preview, Pages, etc.) remain “open” after the last file has closed, and the icon no longer appears in the dock.
When I try to empty the trash or do other functions, I first have to use the CMD+OPT+ESC to open the “Force Quit Applications” panel, force them shut. Perhaps the intention is to quickly hot load new files, making a computer feel zippy fast.
In reality, quite the opposite, a new time suck has been created by requiring my time. Not only a frustrating waste of time, but also a waste of CPU / RAM.
MPG: this seems to be a distinctly different case: applications that the user has quit, but remain open (vs open applications keeping open files long since not needed). However it’s possible some underlying lazy* garbage collection algorithm is responsible for both at some level.
MPG also regularly observes ghost applications in Activity Monitor and has seen these trash-emptying problems, particularly with Apple Preview—PDFs in the trash remain open long after quitting Preview.
A guess: ghost applications could be related thefeature (or some underlying facility that it requires). Since is off on all MPG machines, that would not explain it—but that presumes is not buggy like the rest of OS X.
* “Lazy” as used here is computer programming terminology, not a pejorative.
Arne E writes:
I can confirm that the still-open Mail sent attachment has been a problem for a long time. I remember having to deal with it on Yosemite and even Snow Leopard, and to deal with it is very easy:
diglloydMP:MPG lloyd$ rm -rf /Volumes/*/.Trashes/*/*
No sudo needed… it just sits in one of my BitBar plugins as "Force Empty Local Trash". No need to quit Mail; force empty works while Mail is still running.
MPG: Terminal is a useful tool indeed. Another way to do it for a few files is to type 'rm ' (without the quotes and with the following space), then drag any problem files into the terminal window, which will insert the file names with path. Press RETURN and they’re gone.