MacOS – Tried to hide a dock icon but failed

applicationsdockmacos

I tried to hide an app's icon on the dock but the app (Clock) could not be launched.

I googled and found some solutions to dock icon hiding.

I modified the app's Info.plist by adding the following two lines:

<key>LSUIElement</key>
<string>1</string>

I also tried this:

<key>LSUIElement</key>
<true/>

But, it didn't work. The app couldn't be launched.
The pop-up window says:

Clock quit unexpectedly.
Click Reopen to open the application again. Click Report to see more detailed information and send a report to Apple.

The app is "Clock" (like the desktop gadget in Win7) that I downloaded from App Store.
http://clock.projectworld.net/

I am wondering whether this app can be modified as an agent or not.

Best Answer

I suspect that the Clock application is code-signed, which is likely what is causing the crash. I tried to do the same LSUIElement change in the plist file to Clock.app and it gave the same crash. Some research told me the following:

There's one more step to the process if the developer has signed the application with an Apple Developer Certificate — and that includes all Mac App Store applications. Without this step, you'll likely get a crash when opening the app. To prevent this, you'll need to re-sign the application using the following command in the Terminal:

sudo codesign -f -s - /path_to_app/appname.app

Replace "/path_to_app/appname.app" with the path and the application name that you just tweaked the Info.plist for. After doing this, press enter, and enter your password. The application will be re-codesigned and you should be able to launch the app without any issues.

source: http://www.maclife.com/article/columns/easy_mac_hacks_run_os_x_applications_without_their_dock_icon

I have downloaded Clock.app, Added the LSUIElement key to the plist file, and I resigned the application, and it seems to have had the desired result you are looking for.

There are some considerations though, the only way I could close the app without a dock icon was to use Activity Monitor and kill the process. The link I pasted above also gives a few more warnings you should read before doing this.

Make a backup, try it out, and let me know if you have the same success I did?