snielsen / DeathToDSStore

.DS_Store is an abomination and must be stopped.
http://www.aorensoftware.com/blog/2011/12/24/death-to-ds_store/
398 stars 29 forks source link

How to run silently in the background on login #6

Open MareoRaft opened 6 years ago

MareoRaft commented 6 years ago

Hello!

Your description says that "you can also run it through the command line under sudo with the “-silent” option". However, I have not been able to do that. Would you mind giving a short step-by-step for how to make this run silently when my computer logs in?

Thanks, Matt

ghost commented 6 years ago

Assuming the app is in your downloads folder: $HOME/Downloads/DeathToDSStore.app/Contents/MacOS/DeathToDSStore -silent Or: /Users/$USER/Downloads/DeathToDSStore.app/Contents/MacOS/DeathToDSStore -silent

MareoRaft commented 6 years ago

I have the following output:

$ sudo path/to/DeathToDSStore -silent
2018-03-18 13:13:44.962 injector[32618:2142422] bundlePath: /Applications/Utilities/DeathToDSStore.app/Contents/Resources/FinderOverride.bundle
2018-03-18 13:13:44.962 injector[32618:2142422] stubPath: /Applications/Utilities/DeathToDSStore.app/Contents/Resources/mach_inject_bundle_stub.bundle
2018-03-18 13:13:44.962 injector[32618:2142422] pid 32341
2018-03-18 13:13:44.968 injector[32618:2142422] err 0

Is this success or failure? It says "err", but usually 0 is used to indicate success. The relevant code is in mach_star/mach_inject_bundle.c. I would hesitantly guess that this is indeed working, but I wanted to double check.

snielsen commented 6 years ago

Yes, "err 0" indicates that the bundle was successfully injected. Sorry for not being more clear.

That code is resides here: https://github.com/snielsen/DeathToDSStore/blob/master/source/main.m in case you have any bandwidth to help clean it up ;)

MareoRaft commented 6 years ago

This is closer but still not a complete solution. I believe the script needs sudo permission to run, and therefore still requires action by the user. The ideal is that it will run automatically on login with no action by the user.