Under X11 (i.e. mainstream Unix), you can set GUI-related parameters via X resources. To disable toolbars:
Emacs.toolBar: 0
This does not apply to a native Mac program. You can set some GUI parameters through user defaults (see examples of defaults write org.gnu.Emacs …
in the Emacs Wiki), but I don't know if there's one about the toolbar.
Looking at the Emacs startup process, if you want to execute code before the initial frame is opened, you have a few choices. None of them are really intended to do what you want to do but it should work nonetheless. All of them involve changing a file in the directory which is on the load path before your init file runs. You can add load path directories by setting the environment variable EMACSLOADPATH
. In one of those directories, edit or create subdirs.el
and add the line
(setq tool-bar-mode 0)
This does not affect existing frames, but we're doing this before any frames are started, so I think it will work (but I haven't tested). It may help to also have
(setq default-frame-alist (cons '(tool-bar-lines . 0) default-frame-alist))
(setq initial-frame-alist (cons '(tool-bar-lines . 0) initial-frame-alist))
But rather than seek this, I would just start the Emacs daemon at session startup and then open windows in the existing session as needed.