How to make a Cocoa command line application ?

If you need a Cocoa application that acts mainly as a daemon but it some circumstances show up some GUI or need access to the AppKit framework…
In the advanced options of the Info.plist create a new key named LSUIElment and sets its value to 1.
Now the application will be launched as a UI element. UI elements don't have a foreground, don't appear in the Dock, and don't appear in the Force Quit list, but can open window manager connections.