Hidden script app


I can’t remember how to make a script app hidden after launch. Did I need to change something in the resource fork? Can’t remember.


Model: MacBook Pro
AppleScript: 2.2.3
Browser: Safari 536.26.17
Operating System: Mac OS X (10.8)


You must add a property to the info.plist file: “Application is background only” and set its value to true (1).

Hi McUsrII,

I had a feeling it was in some plist somewhere. I tried looking at it in ResKnife and HexEdit, but couldn’t find anything. I’ll look at the info.plist file. Now, where is the info.plist file? :smiley:


Nevermind, I found it in the bundle.


Hi McUsrII,

I found that LSBackgroundOnly is the key.

Thanks for steering me in the right direction,

ps. BTW, if you make your script background only, your script needs to handle being in the background only.

The key should be LSUIElement, it’ll run the application in some sort of background. It will not appear in the dock nor in the force quit menu but you’re still able to show dialogs. Systems events and systemUIServer are UIElement applications and not background applications for example. It can be confusing because here at MS there are too many posts that say it should be LSBackgroundOnly while it should be LSUIElement. Also don’t use NSUIElement because it’s an old key and deprecated since the introduction of Launch services.

Hello. :slight_smile:
Hence why I used the “human readable form” of the key from property list editor: “Application is background only”.

It was nice with a walk-through of the do’s and don’t of an “agent” applet again. They are hard to find when you look for them :smiley: But they do show up in activity monitor!

Speaking of Agents, and completing the picture. Lauch agents based on applescript, I believe are not entitled to show up with dialogs and such at all. But you can circumvent this by telling an applet to do so for you.


I see what you’re writing. When I ran the app with LSBackgroundOnly and had forgotten to run a dialog through System Events or Finder, I had to restart the computer to get rid of the dialog.:slight_smile: I used to quit applets with Script Editor, before, when things like that happen. I guess with the LSUIElement key, the user can interact with the dialog without putting it in a System Events tell block. This should make it easier.

I did see a lot of people using LSBackgroundOnly, when searching on the internet.

Editted: I remember using the plist editor before, but can’t find it here in Mountain Lion. Did it come with Developer Tools?

Thanks a lot,


I’m pretty sure that property list editor ships with Developer tools. Hopefully those are free again, and sorry about making assumptions about you having it installed.

Instead of restarting, when such things happens, you can try killing either SystemUIServer, System Events, Finder, or all, besides your offending process in Activity Monitor, so you don’t have to restart.

I have scripts that does it for me. :slight_smile:

To kill System events:


kills system events nicely

ps -Al | grep System\ Events | head -n 1 | grep grep || killall System\ Events[/code]
You’ll have to make it executable before you put it into the Script Menu, I kill the other stuff from Activity Monitor.

It’s been discontinued. Xcode itself opens property list files – you can get it from the App store.

Hi Shane,

I found it. Double clicking on the info.plist opened it in Xcode’s plist editor.


Here is well described the meaning of the launchservices keys.

That doesn’t mean you should too ;). I know it sounds also more logic because key LSUIElement doesn’t make sense while the LSBackgroundOnly key speaks for itself. AppleScript should be able to get active state but that’s not possible with LSBackgroundOnly. When you have an stay-open script and activate your script with an external script you’ll get an error too and system (can) hang. My advise is always to use LSUIElement, even when you’re not showing dialogs to make use of all scripting functionality and to avoid unexpected errors.

Why you see a lot of people using LSBackgroundOnly is because most code is written in the Mach-O format. Even when there are Mach-O binaries when the script is stored as application the actual code that’s running is not Mach-O. In other words your AppleScript loader and runner are Mach-O but code that is loaded is not (your script). Apple’s documentation says also clearly to use LSBackgroundOnly key only with Mach-O binaries.

Hi DJ Bazzie Wazzie,

Interesting stuff and I’ve been looking for a list of keys just like that.