macOS emacs in the terminal (no GUI)

You should be able to run

emacs -nw

(„no window“) to prevent it from opening a new window.


Updated answer for macOS 10.15+ (Catalina) or using the zsh shell:

emacs -nw still works, but if you want to make an alias for this (so you don't have to type it in every time) complete the following steps:

1) Navigate to your home directory using cd ~

2) Open up the .zshrc file (its okay if it doesn't yet exist) with emacs -nw .zshrc

3) Type: alias emacs='emacs -nw' (make sure there are no spaces on either side of the equals sign or it will not work)

4) Quit Terminal, restart it, and emacs should now default to the in-Terminal/no-GUI version.