How to write a tilde (~) character in Emacs on Mac OS X?

Jan Deinhard picture Jan Deinhard · Jun 20, 2012 · Viewed 11.2k times · Source

I'm used to write a ~ character by pressing Alt+N on Mac OS X. This does not work in Emacs. Alt+N key seems to be bind to the command history. So my question is how to write a ~ character in Emacs on Mac OS X?

EDIT: I'm using Aquamacs.

Answer

fpbhb picture fpbhb · Nov 8, 2015

While this question is pretty old, none of the answers seems satisfying for Emacs for OS X (the most popular choice these days). So, for future readers ...

Plain Emacs for OS X uses both Alt keys as Meta by default. As many characters are typed using Alt on a german Mac keyboard (tilde, brackets, curly braces etc.), I'd recommend setting ns-right-alternate-modifier to nil, which enables typing tilde (Alt-n) and other characters using the right Alt key, while the left one can be used as Meta (like for M-x).

Alternatively Cmd can be customized to be Meta. All options can be interactively customized under M-x customize-group ns.