Hiding menu bar on Applescript application - faceless/background

I have built a small app in Xcode with a single main window. I am wondering if it is possible to have the application run faceless (i.e. no menu bar) showing only the main window in which things happen.

There has already been a thread which asks the same question: Remove the Menu bar completely?

However, no answer appears on the thread. Yet as the posters there say, it must be possible. I know that I have seen it done on a very basic Xcode app so am hoping that the trick is relatively simple.

By the way, I have tried deleting the menu item from the Nib file but that doesn’t work. A default menu bar appears anyway.

Anyone have any ideas? Help would be much appreciated.


Moving to the correct forum.

By the way, what is wrong with jj’s suggestion? Try adding this to your Info.plist file:

<key>LSUIElement</key> <string>1</string>
See also: Property List Key Reference (Info.plist)


Sorry. And I posted again in the OS X forum thinking I must have had a memory lapse. My other post should be deleted.

Anyway, I had tried jj’s suggestion but it didn’t change anything for my app. I was also conscious of the fact that the reply to jj’s suggestion reported that his fix made the interface invisible as well as the menu bar.

Any other ideas?

Just a quick update

I managed to get jj’s fix to work but it does as the previous poster found out. In other words, everything gets hidden, including the interface. Not a solution I am afraid.

I’ve used “LSUIElement” before, and it has always worked fine.

Have you tried cleaning and rebulding your project?


I think I am getting somewhere with “LSUIElement”. The project first of all was not rebuilding (although it said it did each time) and then I could not locate the main window. I think I will need to work in some extra code to try and make the App window stay in front. At least I know it is there now.


I am back again with a problem arising from use of “LSUIElement”.

Before making the App’s menu bar disappear using “LSUIElement”, I had scripted to make sure that whenever the user switched to iTunes, the App window would come to the front. Conversely, if the user switched to the App, iTunes would be activated immediately behind the App. This way, the user woud always have the App in his face when switching to iTunes until the App had finished its task - showing progress of the vanilla script. The code I put in to do this is in a handler that gets called regularly:

on checkWindowstate(last_Looked_iTunes)
	if ((frontmost of application "iTunes") is true) or (frontmost of application "My App" is true) then
		if last_Looked_iTunes ≠ true then
			tell application "iTunes" to set visible of window "iTunes" to true
			set last_Looked_iTunes to true
		end if
		set last_Looked_iTunes to false
	end if
	tell application "System Events"
		if (visible of process "iTunes") is false then
			set visible of process "My App" to false
		end if
	end tell
	return last_Looked_iTunes
end checkWindowstate

Since making the App’s menu bar disappear by building it with “LSUIElement” in the info.plist, I am unable to replicate the behaviour I had before. After all my unsuccessful attempts to replicate the old behaviour, I have now turned off all window manipulation in the script (ie it no longer calls to checkWindowstate). What now happens is this:

(1) I run the vanilla script from the iTunes menu which fires up the App. All is fine at this stage. The App sits in front of iTunes showing progress.
(2) I to the Finder (for example). The iTunes windows and the App are obscured by Finder windows.
(3) I back to iTunes. The iTunes menu bar appears but the iTunes window fails to come to the front. There is no sign now of the App window.
(4) If I to Safari then back to iTunes, the menu bar stays stuck on iTunes (but greyed out).
(5) By ing backwards, I can sometimes get the iTunes window to appear but not the iTunes menu bar
(6) Running a short test applescript from Script Editor along these lines will make the App come to the front:

tell application "My App"
	show window 1
end tell

(7) However, doing the same test script for iTunes (or any test script hoping to make iTunes react and come to the front), leaves the test script hung. Only quitting out of “My App” will allow me to exit the test script.
(8) I can always recover by using exposé to locate My App’s window and cancel out using the cancel button in My App.

I am not clear on what is going on and why I am unable to control the relative position/visibility of “My App” and “iTunes”. Basically, as it currently stands, if the user tabs out of iTunes while the vanilla script is running, he can only recover by using exposé to find the progress window in My App.

Can anyone shed light on this behaviour and advise how I may recover control of my windows?

After some messing about, a kind of solution was achieved. Reworked the Window handler using calls to “System Events” rather than trying to address “iTunes” directly. This at least works to the extent that tabbing around between apps will always give end up with My App in front of iTunes when iTunes is selected. But the solution will not allow you to hide My App at all. You can hide iTunes by using the Finder hide all others but My App will never go away!

Still, at least the user will never lose sight of My App when back in iTunes, which is the main thing. The new handler is as follows:

on checkWindowstate()
	tell application "System Events" to tell application process "iTunes" to set testinFront to frontmost
	if testinFront then
		tell application "System Events" to tell application process "iTunes"
			set frontmost to true
			set visible to true
		end tell
		tell application "My App" to set hidden to false
		tell application "System Events" to tell application process "My App" to set frontmost to true
	end if
end checkWindowstate