60

Is there a way to hide certain apps from cmd+tab?

The problem I'm facing is that I have some apps (like iTunes and of course Finder) always open. But when I'm working and switching between apps that are relevant for me (Chrome, Sublime, Terminal) with cmd+tab I'll always see these 'irrelevant' apps in the menu.

Thanks

grg
  • 201,078
wpp
  • 1,105
  • 4
    Most of the answers here are irrelevant on Catalina, Big Sur, and later. Due to SIP any edits to Info.plist will cause the application to give an error on launch. – johndbritton Nov 17 '20 at 03:07

5 Answers5

46

Yes, it is possible, however the only way I know of doing it also hides the dock icon.

Set the boolean LSUIElement.

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

Source: LSUIElement - Property List Key - Apple Developer

In macOS Catalina 10.15 and later, the boolean is enforced. Previously, a string of "1" could be used.

Source: Re: LSUIElement and LSBackgroundOnly - Cocoa-dev mailing list

you must modify the file named 'Info.plist' inside the Application's package (i.e. Sherlock.app/Contents/Info.plist). Open this file in your favorite text editor and add the following section (if it's already present simply change the 0 to a 1 in the string tag):

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

Source: Hide any program’s Dock icon - Macworld Mac OS X Hints

grg
  • 201,078
  • holy smokes that worked better than expected thanks a lot! – wpp May 21 '13 at 20:50
  • 2
    Two comments. First, the above [STRING] format will not work in 10.8 -- you need to use a boolean type. Second, besides hiding the app from the application switcher, modifying the NSUIElement will also hide the menu bar, so using the "hidden" applications becomes quite difficult. – Kent May 21 '13 at 23:56
  • 1
    Have you had any luck with LSUIElement in Mavericks? – atreat Oct 24 '13 at 03:09
  • It told be I had to change permissions of the Info.plist file. I changed both the plist and the Contents folder, but still no luck. I use it with an app called TotalTerminal, and that warns me that it isn't quite version compatible when it launches. I bet that may be the inconsistency. – atreat Oct 25 '13 at 01:41
  • @atreat Ah, haven't tried it with TotalTerminal, although FYI they did release an update yesterday to provide Mavericks support – grg Oct 25 '13 at 05:35
  • 2
    Yep, I downloaded the update, they now support it natively with their v1.4.2 release. https://github.com/binaryage/totalterminal/issues/3#issuecomment-26988325 – atreat Oct 27 '13 at 18:18
  • 7
    In Mavericks, this crashes for me. I've tried a couple of different applications. – sandover Feb 18 '14 at 18:50
  • @sandover This is probably because you're modifying a sandboxed app, which will cause it to crash upon launch to prevent modification. – grg Feb 18 '14 at 18:52
  • Does this work in Yosemite? Using the app Fluid, I have tried making these changes but they seem to get overwritten as soon as I launch the program. The value for LSUIElement is <false/>. I tried simply changing that to <true/>, and also to <string>1</string>, but no dice. I save the plist file, then launch the program, but it appears in the command+tab switcher and on the dock. When I look at the plist file again, I see that it has reverted back to the original <false/> value. – maxedison Nov 13 '14 at 14:50
  • will this also hide the application window but not terminate the application program (ie run in the background?) – bouncingHippo Sep 28 '15 at 18:20
  • This works great and it seems you can keep the application in the dock if you select the "Keep in Dock" option before doing this step. – Michael Mior Oct 31 '18 at 14:10
  • @Gigi What is the ‘newest version’ of macOS specifically? – grg Sep 06 '19 at 05:46
  • Adding this on Google Chrome will lead to app crashing. If I set the value to 0 or false it will not crash. Is there any reason why it would not work on some apps? – AnthoPak Oct 31 '19 at 13:50
  • On Catalina, with either LSUIElement solution, I get The application <theAppYouModified> can’t be opened. – Tor May 15 '20 at 18:50
  • Has anyone found a workaround for this with SIP? – johndbritton Nov 17 '20 at 03:05
  • This works great in Ventura 13.2.1, however the issue I'm encountering is that there's no way to cmd+h and hide the application anymore. I have a shortcut (via BTT) to bring it to the front/show it, but the toggle to hide it is no longer functional. – Tony Mar 22 '23 at 19:44
9

You can set LSUIElement to 1 as string in the Info.plist:

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

It removes applications from the application switcher, Dock, and the force quit window. It also removes the menu bar, so it's not really usable with Finder or iTunes.

Editing an Info.plist makes some applications like TextEdit and Chess crash on launch in 10.8. It also invalidates the code signatures of signed applications, so they are not allowed to access keychains automatically.

http://www.cocoabuilder.com/archive/cocoa/141753-lsuielement-and-lsbackgroundonly.html:

NSUIElement is depreciated. However, I remember clearly from working at Apple (Apple DTS) a few years back that NSUIElement and LSUIElement map to the same thing (at least it did back when I was there and I doubt that would have changed). Though NSUIElement is depreciated (NS stands for next step of course! and LS stands for launch services), they are exactly the same thing for all intents and purposes.

Both LSUIElement and NSUIElement still work, and both can also be set to true or 1 as integer.

grep -A1 [LN]SUIElement /Applications/*/Contents/Info.plist

Information Property List Key Reference: Launch Services Keys:

LSUIElement (String - OS X) specifies whether the app runs as an agent app. If this key is set to “1”, Launch Services runs the app as an agent app. Agent apps do not appear in the Dock or in the Force Quit window. Although they typically run as background apps, they can come to the foreground to present a user interface if desired. A click on a window belonging to an agent app brings that app forward to handle events.

The Dock and loginwindow are two apps that run as agent apps.

Witch has an option to ignore applications:

I have just disabled the application switcher and Dock though. I mainly use keyboard shortcuts and Alfred to switch applications.

Lri
  • 105,117
4

Disclaimer: I developed GhostTile

Short Anwser: just try GhostTile. It's paid though but you can try as long as you can (steal the idea from Sublime Text)

Long Anwser:

AFAIK, There are two ways to achieve this:
1. Setup an App as Agent. E.g. Add LSUIElement key to App's Info.plist or Set App's activation policy to NSApplicationActivationPolicyAccessory.
2. Hook Dock or other related system process to ignore some apps. Thanks to SIP(Rootless) on El Captian. It's not recommended to do so.

GhostTile is focus on hiding Apps from Dock. It's easy to use and provide multiple ways to manage the apps you hide. There is no on-disk modification, so you won't break apps' codesign signature.

Other features:

  • You can still get notified for the App's Dock Activity
  • Expose-like Overview
  • Alfred Workflow
  • Just tried this app and none of the apps I tried are "supported yet". Finder, Mail, iOS Simulator... – pkamb Jul 22 '16 at 19:45
  • 1
    @pkamb I'm sorry but all the apps your tried is protected by System Integration Protection (SIP) introduced in El Capitan. Could you please try other third party apps? or turn SIP off? – hewigovens Jul 23 '16 at 00:30
  • Fair enough, thanks for the answer. I'd suggest a more informative error message or link to an FAQ! – pkamb Jul 23 '16 at 16:25
  • How do I hide Ghost Title from Cmd+Tab launcher ? I tried adding NSUIElement 1 to Info.plist and restarting the app. It didnt work – mac May 03 '17 at 10:53
  • @mac There is a preference option called "Hide GhostTile from Dock" – hewigovens May 04 '17 at 04:26
  • Awesome. Didn't know that option can hide ghosttile from Cmd+Tab laucher as well ;) – mac May 04 '17 at 06:43
  • That option has a unintended consequence. It adds a item in top menu bar making it cluttered now ;) – mac May 04 '17 at 06:46
  • Tested it, but on OSX Sierra it seems also "Not supported yet" for third party applications. – Sascha Jun 10 '17 at 17:30
  • @hewigovens interesting application. how did you implement the dock hiding and window switcher hiding? which APIs did you use? looking to find a similar possibility for a project. thanks in advance! – Jelko Jun 14 '17 at 14:05
  • Hugely disappointed. GhostTile appears to be for hiding from the dock not the Application Switcher, which is what this question was about and is what I was looking for. Just wasted a bunch of time trying to figure out why it wouldn't work. – JVC Jun 28 '18 at 02:39
1

Sorry to be late to the party, but indeed as previous answers and comments state, this might make some applications to crash on launch. I can't make this work in Yosemite although I was able to make it work before on another Mac. Changing the TotalTerminal Info.plist did not do anything, and changing the Applications/Utilities/Terminal/Info.plist caused the crash.

As @atreat mentioned in one of the comments, the guys from TotalTerminal are now supporting this hide via a simple command:

defaults write com.apple.Terminal TotalTerminalHideDockIcon -bool YES

This worked perfectly for me.

Raul Rene
  • 123
0

If you are using an iPhone and has similar problem with hiding an app from the App Switcher, you can install something like BlacklistSwitcher9.