Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this line in my .emacs file:

(tool-bar-mode 0)

because I hate the toolbars in my GUI emacs (/Applications/

But when I start up my other, text-based emacs in the terminal (/opt/local/bin/emacs) it complains about that command:

Symbol's function definition is void: tool-bar-mode

How can I add an if condition so that it executes the tool-bar-mode command only when I'm in the GUI emacs?


share|improve this question

Okay, found it myself. Just add

;; turn off toolbar
(if window-system
    (tool-bar-mode 0))
share|improve this answer

another way to do it would be:

 (if (functionp 'tool-bar-mode) (tool-bar-mode 0))

like this, the function is called only if it exists

share|improve this answer

It works for me without complaint on Linux. You might try nil or -1 instead of 0:

(tool-bar-mode nil)

What happens if you do emacs -nw?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.