How to disable menu bar in macOS?

What happened?

I want to disable the menu bar in macOS. I know menu-bar-mode is responsible for this, but in the doom source code:

;; HACK: I intentionally avoid calling `menu-bar-mode', `tool-bar-mode', and
;;   `scroll-bar-mode' because their manipulation of frame parameters can
;;   trigger/queue a superfluous (and expensive, depending on the window system)
;;   frame redraw at startup.
(push '(menu-bar-lines . 0)   default-frame-alist)
(push '(tool-bar-lines . 0)   default-frame-alist)
(push '(vertical-scroll-bars) default-frame-alist)
;; And set these to nil so users don't have to toggle the modes twice to
;; reactivate them.
(setq menu-bar-mode nil
      tool-bar-mode nil
      scroll-bar-mode nil)
;; FIX: On MacOS, disabling the menu bar makes MacOS treat Emacs as a
;;   non-application window -- which means it doesn't automatically capture
;;   focus when it is started, among other things, so enable the menu-bar for
;;   GUI frames, but keep it disabled in terminal frames because there it
;;   unavoidably activates an ugly, in-frame menu bar.
(eval-when! doom--system-macos-p
  (add-hook! '(window-setup-hook after-make-frame-functions)
    (defun doom-restore-menu-bar-in-gui-frames-h (&optional frame)
      (when-let (frame (or frame (selected-frame)))
        (when (display-graphic-p frame)
          (set-frame-parameter frame 'menu-bar-lines 1))))))

As a result, menu-bar-mode cannot be called by the user. So I have no idea how to write my config.el.

What did you expect to happen?

I still want to disable the long menu bar even at the risk of non-application window.

System information

Loading data dump...

Are you really sure you need to do that? Last I checked, on MacOS menu-bar-mode only affects the OS menu bar (outside of Emacs), not the inside-Emacs menu bar. Disabling menu-bar-mode breaks how MacOS treats Emacs frames and shouldn’t have much visible effect (besides reducing the number of items in the OS menu bar when Emacs is focused).

If this isn’t the case for you, please include screenshots, because maybe things have changed in recent versions of MacOS.

In any case, I’ll revisit that hack to make it easier to “break out” of.

EDIT: For the time being, you should be able to get around this by simply removing the hook:

;;; in $DOOMDIR/config.el
(remove-hook! '(window-setup-hook after-make-frame-functions)
1 Like

Yes, I really want to disable that :innocent:.

That’s because I’m using MacBook with the annoying notch, so my menu bar has less space. Emacs really occupies much of the space:

It’s cumbersome, and many of my menu bar items are just concealed and unreachable (thanks to Tim Cook). I know there are third-party software dealing with the problem, but I think it’s more reasonable to remove this useless Emacs menu bar and rescue my useful menu bar items from the hole.

This works for me. I also add the line:

(menu-bar-mode 0)


It seems that, after this configurations, Emacs can be auto-focused when it’s started (at least on my Mac). I’ll try more cases to discover potential side effects.