Where is the .emacs file?

I downloaded Emacs 23.1 from GNU's FTP site. I untarred it and built it after configuring.

I do not find the .emacs file in my home directory or anywhere in my system! Am I missing something?


Or, as a much simpler way (as pointed out in the comment), Ctrl+H, v (describe-variable) will bring up nice output describing the variable and its value, like so:

    user-init-file is a variable defined in ‘C source code’.
    Its value is
    "/home/.emacs"

Documentation:
File name, including directory, of user's initialization file. If the file loaded had extension ‘.elc’, and the corresponding source file exists, this variable contains the name of source file, suitable for use by functions like ‘custom-save-all’ which edit the init file. While Emacs loads and evaluates the init file, value is the real name of the file, regardless of whether or not it has the &lsquo'.elc’ extension.

This way is quite verbose. A more concise answer is to start up emacs and, in your Lisp evaluation buffer, type user-init-file and press Ctrl+J to evaluate. This will print out where your init file is, like so:

user-init-file
"/home/.emacs"

You have to create the file if you want to configure Emacs. You can just create it and start hacking the file manually or use M-x customize and save the customization.


See InitFile chapter in EmacsWiki.

Your init file contains personal EmacsLisp code that you want to execute when you start Emacs.

  • For GnuEmacs, it is ~/.emacs or _emacs or ~/.emacs.d/init.el.
  • For XEmacs, it is ~/.xemacs or ~/.xemacs/init.el.
  • For AquamacsEmacs, it is ~/.emacs or ~/Library/Preferences/Aquamacs Emacs/Preferences.el