Reclaiming Screen Real Estate
By default, macOS displays a persistent, translucent menu bar across the very top of your screen, housing the Apple menu, application menus (File, Edit, View), and your system status icons (Wi-Fi, Battery, Clock). On smaller MacBooks, this menu bar consumes valuable vertical pixels. While you can configure the menu bar to automatically hide and show by navigating through System Settings > Control Center, system administrators setting up kiosk machines or strict presentation environments often need to enforce this behavior via the command line.
Using the defaults write Command
In macOS, almost all graphical user interface preferences are stored in hidden .plist (Property List) files. The defaults command allows you to read and write directly to these databases without clicking through the GUI.
The menu bar behavior is controlled by a specific boolean (True/False) flag within the global system preferences.
- Open the Terminal application (located in Applications > Utilities).
- To force the menu bar to automatically hide (sliding up off the screen until you push your mouse cursor against the top edge), execute the following command:
defaults write NSGlobalDomain _HIHideMenuBar -bool true
- Press Enter.
Applying the Change (Restarting SystemUIServer)
Unlike Linux configuration files, simply writing the new rule to the macOS database does not immediately apply it to the active graphical environment. The macOS window manager has already loaded its preferences into RAM.
You must restart the core background graphical services to force them to read the new database entry.
killall SystemUIServer
Your screen may flicker for a fraction of a second, and the top menu bar will instantly slide away, leaving you with a completely clean desktop.
How to Restore the Menu Bar
If you decide you dislike the auto-hiding behavior and want the persistent menu bar back, you must flip the boolean flag back to false and restart the UI server again.
Run these two commands in sequence:
defaults write NSGlobalDomain _HIHideMenuBar -bool false
killall SystemUIServer
The menu bar will immediately reappear and lock itself to the top of your screen.