To edit TrashIcon.icns using hex editor to get access to the dark icons

In /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources there is a file TrashIcon.icns. Alexander O’Mara, a guy who is a security expert at Mastercard discovered that this file contains not only “bright” icons but also “dark” ones. But to get access to the dark ones, you need to modify the file using a hex editor.

I never worked with hex editors and the instructions he gave are not very clear to me.

Alexander: I don’t know of any existing tools, but it’s pretty simple. Find the chunk inside TrashIcon.icns named FD D9 2F A8, copy it, and overwrite FD D9 2F A8 with icns. That will make it a valid icns file. From there you can extract the individual icons from the dark icns file using a tool like iconutil.

Me: Many thanks. But I’m not sure I understand the first part. […]

Alexander: I’d recommend making a copy of the icns file, finding FD D9 2F A8, selecting all the hex on the left that comes before it, deleting it, then on the right side overwrite the first 4 bytes with icns, and save.

https://github.com/Ji4n1ng/OpenInTerminal/issues/211

I still don’t understand how to “overwrite the first 4 bytes with icns, despite I’m not computer- or programming-illeterate person. Could you explaint it to me? An animated GIF will probably be the best option.

But that’s in /system/library. That whole volume is immutable, meaning you can’t write to it.

The days of modifying macOS are fast disappearing, if they haven’t disappeared already.

i’m not going to edit it there, neither I’m going to modify macOS in such a way. I want to exctact the “dark” Trash icon so that I will be able to attach it to a regular folder. The final idea is to have “local” Trash folders here and there, e.g., in my ~/johndoe_/swift or ~/johndoe_/history-and-mythology folders.

never would have thought of that…

there’s a hex side and a translated side in a hex editor; I’m using HexFiend, on the AppStore.

Screen Recording 2024-04-13 at 17.54.43

1 Like

Many thanks, Steven. Here is another solution, thanks to Brielle Harrison who created icon_records exactly for this!

and where is icon_records? all I’m finding is recording labels.

Oh, sorry. Here is the link to my own answer on Ask Different: https://apple.stackexchange.com/a/471877.

  1. Download icon_records from https://github.com/nyteshade/icon_record_extractor (or read the code and compile it yourself…)

  2. chmod +x icon_records to allow Terminal to treat it as an executable

  3. ./icon_records TrashIcon.icns dark

that’s it

Copied your last post to Agenda.app/Technical/macOS Terminal Notes

Thanks to you, I now know how to use HexFiend a little bit, use Screenshot to make a short video of a selected area of the screen in .mov format for customer support, use Gifski to convert that to a .gif file so I can email that to a client.

Glad we helped each other, and thanks for this list of apps! What I like about this forum is that people are really friendly.

Thank you for showing me something new. This place is way better than many other fora I’ve been to.