Maintaining a clean workstation is perhaps one of the best ways to help with productivity and clear-thinking. Not only does this apply to one’s desk or office, but for those of us who work with computers, it extends to the Dock, folders, and desktop. Keeping things clean and orderly in OS X is vital for getting things done efficiently, and this Mac tip helps do exactly that.

This is accomplished by running a Terminal command that will hide an app of choice (automated equivalent to ⌘H) when it loses focus – that is, when you click anywhere else on the screen. This is great for apps that you find yourself referencing often but that are in the way when not in use. The downside to this tip is that users are required to run the command for every app to which they want to apply this action, and specifying each app requires its unique bundle identifier, so this tutorial is slightly in-depth.

Step 1: Locate the bundle identifier of the app you wish to automatically hide.

This can be found by navigating to the app in your Applications folder, right-clicking on it and selecting Show Package Contents, and viewing the Info.plist file in the Contents folder. Look for the value belonging to CFBundleIdentifier, which, in the case of the Twitter for Mac app, is com.twitter.twitter-mac, and this is what you’ll use to craft your Terminal command.


Step 2: Open Terminal. This can be done by searching for Terminal in Spotlight or by locating it in the Applications folder. Your version of Terminal may look different from mine, and that’s ok.


Step 3: Enter the following command into Terminal after substituting com.twitter.twitter-mac for the bundle identifier of your choice and press return:

defaults write com.twitter.twitter-mac HideInBackground -bool true


The app you specified should now automatically be hidden when it loses focus, meaning when you click somewhere else on the screen or when you use ⌘Tab to select a different app. Enjoy a cleaner desktop in which apps of your choice automatically go away when you don’t need them.

Reverting back: If you want to undo this action for a particular app, simply follow the above steps to enter the command in Terminal, but change true to false on the end of the command.

defaults write com.twitter.twitter-mac HideInBackground -bool false

If this isn’t exactly what you’re looking for, be sure to check out Jeff’s posts on how to quickly hide everything but your current app and the difference between hiding and minimizing apps in OS X.

  • Hi

    Very nice, thanks for this tip. If only you could do it for all apps in one go., as doing 30 apps will take a while

    • coLin

      “You can also use a simple keyboard shortcut: Option (⌥)+Command (⌘)+H and that will hide all other applications” by iDB

      • Hi

        thanks, i never new that, this will hopefully stop me having 30 windows open in one go lol 🙂

    • I’m not very good at shell scripting but this seems to mostly work to apply the command to all apps at once:

      cd /Applications && for f in *.app; do file="/Applications/$f/Contents/Info.plist"; CFBundleIdentifier="CFBundleIdentifier"; output=$(sed -n ":$CFBundleIdentifier: {n;p;}" "$file" | sed "s/]*>//g" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'); defaults write "$output" HideInBackground -bool true; done

  • Zen Kaojarern

    I’m not sure what article it was, but Hocus Focus does the job extremely well.

  • Nate Holland

    Another easy way to do this is to just hold Option ⌥ and click out of the app you’re using. That hides the app you were previously using without affecting any other open/hidden apps.