I'm currently using Homebrew to install both the command line version of Emacs and the GUI version of emacs, with the following commands:

brew install emacs
brew cask install emacs

When I first install the command line version, I can launch it via the command line with the command emacs <filename>, but after I install the GUI version, using that same command, it causes the GUI version to open. I would like the command line version to continue to open from the command line command. I posted this in the homebrew forum, but the only answer I was given was to check my shell config file. I'm on macOS Catalina, so I'm assuming .zshrc is the file, but this contains nothing relating to Emacs at all. Any suggestions for how to keep the GUI version from being launched from the command line command would be greatly appreciated.

  • 1
    What happens if you run emacs -nw on the command line?
    – jksoegaard
    Commented Dec 3, 2019 at 22:36
  • @jksoegaard, it opens the command line version! Is there a way to set this to the default? Commented Dec 4, 2019 at 5:24
  • 1
    Yes, I've added an answer with instructions!
    – jksoegaard
    Commented Dec 4, 2019 at 9:04

1 Answer 1


You could create an alias in zsh that invokes emacs -nw whenever you write emacs. The -nw argument means to start emacs in "non-windowed" mode - i.e. a command line text interface.

You can create the alias by editing the .zshrc file you mention, and add the following line:

alias emacs="emacs -nw"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .