Hazel rule to move mounted app installers to the trash

Hi

Does anyone please have a Hazel rule that works for moving a mounted app installer containing a dmg to the trash if was from yesterday?

I’ve tried Kind > is > Disk Image and also Kind > is > dmg but no dice.

Thanks

Did you try with extension is dmg? I tested this and it worked for me.

Yeah tried this too and it still doesn’t move them to the trash. It’s super weird, just also double checked that I didn’t have the Desktop folder rules paused.

Can you test it by changing to “dated added is today” or try using a folder other than desktop? Just to see if either of these works. May help with troubleshooting.

Thank for your help. Still a no go using ‘date added is today’ or using another folder. I’ve just tested the same rule to move a PDF document and that works fine. Something quirky going on with .dmg files and packaged app installers.

Also just tried it with moving the .dmg out of the mounted disk image and that didn’t work either.

1 Like

Isn’t it normally impossible to move a mounted image?
Shouldn’t it be unmounted first?

Just tested this. I mounted a dmg then moved the dmg itself to a folder where a Hazel rule moved it to the trash. It left the mounted files behind, even when I emptied the trash. Didn’t think it would work this way but it did.

I am assuming you did not unmount before moving as you did not mention it. Maybe Finder (which I again assume you used as you did not say) noticed the dmg file mounted so took a copy into the new location rather than moving. I am not at my Mac to test this for you.

I did not unmount.

Hazel moved the original dmg into the trash. After emptying the trash the original dmg is gone. The files from the dmg remain.

@leanda I’m not trying to hijack this topic, just trying to help. :grinning:

Ahha. You are correct. It did in fact move the dmg to the trash but leave the mounted image with a copy of the dmg. I’m guessing there would be no way to automatically unmount the images?

I think you’ll need a shortcut, AppleScript, KBM macro, etc to accomplish this.

Or a short shell script to “umount” called from Hazel. The “man” file will explain the parameters.

Or just get in the habit of manually unmounting img files after used.

This is what I do.

1 Like

I am even not sure, if I would like to use an automatic like that.
Of course, Disk Images are normally App Installer, you would not need anymore, after the App was installed, but you could do more with DMG-Files.
So, I wouldn’t implement an automatism, that unmount and delete all .dmg files, in case I want to use one for an other reason than installing a new app.