Enchilada
Enchilada

Reputation: 3919

How to create a background-running Cocoa application?

How do I create a Cocoa app that runs in the background (not in the dock, and not in the menu bar either; just in the background).

Does the app need admin privileges? I hope not. Actually it shouldn't, because it's enough that the app runs in the background for that user only, i.e. not for all users.

And I guess I can make it "launch when log-in" by just adding it to the user's Account Preferences, so that shouldn't be a problem.

Upvotes: 16

Views: 5612

Answers (2)

Peter Hosey
Peter Hosey

Reputation: 96323

In your Info.plist, set LSUIElement to the string “1”.

The main difference is that a UI-element agent can have a UI (order in a window). A background-only app should be completely faceless; whatever UI it has should exist in a separate application or preference pane.

Upvotes: 12

RyanWilcox
RyanWilcox

Reputation: 13972

In your Info.plist set LSBackgroundOnly to 1.

Upvotes: 18

Related Questions