You type emacs into a fresh terminal and get either “command not found” or a version from three years ago. Both are common, and both are fixed in a few minutes once you know which package to pick. This guide shows how to install Emacs on Linux, how to install Emacs on macOS without fighting Homebrew, and how to install Emacs on Windows so that it finds your config folder the first time. Everything after that, from keybindings to packages, assumes a current build, so the goal here is a recent Emacs and a known location for init.el.
Aim for Emacs 29.1 or newer. That release made use-package, eglot and the tree-sitter major modes part of Emacs itself, and Emacs 30.1 added which-key on top. A config written for those versions is shorter than one that has to pull everything in from outside.
Install Emacs on Linux from your distro’s package manager
On Linux the package manager is the fastest route, and on rolling distributions it is usually the best one too.
On Debian and Ubuntu:
sudo apt update
sudo apt install emacs
Debian splits the editor into variants. emacs-gtk is the usual graphical build, emacs-nox has no GUI at all and is the right choice for a server you only reach over SSH, and emacs-lucid uses the older Lucid toolkit, which some people prefer because it behaves better when the daemon outlives a crashed X session. The plain emacs package pulls in a sensible default.
The catch is age. Ubuntu LTS releases and Debian stable freeze the version for years, so check what you got before writing any config. If it is older than 29, look at the Snap package (sudo snap install emacs --classic), a backports repository, or a source build.
On Fedora:
sudo dnf install emacs
Fedora tracks upstream closely, so the version is normally current within a few months of a release.
On Arch Linux and its derivatives:
sudo pacman -S emacs
Arch also packages emacs-nox for terminal-only machines. Since Arch rolls, you will get the newest stable Emacs and nothing more is needed.
Flathub carries an Emacs build as well, and it is tempting on distributions with old packages. Be careful with it for programming work. The Flatpak sandbox hides much of the host system, so Emacs may not see your compilers, language servers or project tools without extra permissions, and M-x shell lands inside the sandbox rather than on your machine. The Snap package runs in classic confinement and does not have that problem, which is why it is the better shortcut on Ubuntu. For anything you plan to use daily on Linux, a native package or a source build stays the least surprising choice.
Building from source
Building Emacs yourself sounds heavier than it is. It makes sense when your distribution is far behind, or when you want a feature switched on that the packagers left off. The release tarballs live on ftp.gnu.org under gnu/emacs/, and the development tree is on Savannah.
git clone --depth 1 --branch emacs-31 https://git.savannah.gnu.org/git/emacs.git
cd emacs
./autogen.sh
./configure --with-native-compilation --with-tree-sitter
make -j"$(nproc)"
sudo make install
On Debian-based systems sudo apt build-dep emacs installs most of the libraries you need, provided source repositories are enabled. The two configure flags matter: native compilation turns Emacs Lisp into machine code through libgccjit, which makes heavy packages noticeably snappier, and tree-sitter support is what the *-ts-mode major modes need. If configure complains about a missing library, install its development package and run it again. The summary it prints at the end tells you exactly which features made it in.
Install Emacs on macOS with Homebrew or a prebuilt app
macOS ships no usable Emacs, so you choose a build. There are three good ways to install Emacs on macOS, and they differ mostly in how much control you want.
The emacs-plus tap
The emacs-plus tap, maintained by d12frosted, is the build most long-term macOS users settle on. It produces a native Cocoa app, supports native compilation, and lets you pick extras such as alternative app icons.
brew tap d12frosted/emacs-plus
brew install emacs-plus@31
The version suffix follows the Emacs major release, and the available options change between versions, so read the tap’s README before adding flags. After installing, Homebrew prints a command to link the app into /Applications; run it, or Spotlight will not find Emacs.
Emacs for Mac OS X and the Homebrew cask
The quickest way to install Emacs on macOS is the cask:
brew install --cask emacs
This installs the universal binary from the Emacs for Mac OS X project at emacsformacosx.com, which you can also download directly as a regular disk image. It is a plain build of GNU Emacs with no patches, signed and ready to run. Do not confuse it with brew install emacs (no --cask), which gives you a terminal-only Emacs from Homebrew’s core formulae.
There is also the Mac port by Mitsuharu Yamamoto, available through the railwaycat/emacsmacport tap. It adds smoother scrolling and some macOS-specific behaviour, but it trails upstream releases, so treat it as a preference rather than a default.
The short version: use emacs-plus if you already know Emacs will be your main editor, the cask if you are still deciding.
One macOS detail trips up almost everyone. Apps launched from the Dock do not inherit your shell’s PATH, so language servers and tools installed through Homebrew may be invisible to Emacs. The exec-path-from-shell package copies the shell environment into Emacs at startup and solves it.
Install Emacs on Windows: the GNU installer, winget and MSYS2
To install Emacs on Windows, start from the official GNU builds. The GNU mirrors carry them under ftp.gnu.org/gnu/emacs/windows/, with one folder per major version. Each release offers an installer (for Emacs 31.1 that is emacs-31.1-installer.exe) and a zip file. The installer adds Start menu entries and is the easiest option. The zip is handy on machines where you lack admin rights: unpack it anywhere and run bin\runemacs.exe.
If you prefer a package manager, winget has the GNU build:
winget install GNU.Emacs
MSYS2 is the other route, and it suits people who already use it for a compiler toolchain. From the UCRT64 shell:
pacman -S mingw-w64-ucrt-x86_64-emacs
The MSYS2 build sits next to the Unix tools Emacs packages often call, like grep, find and diff, which saves you hunting for Windows ports of each.
Where Windows keeps .emacs.d
This is the part that confuses people when they install Emacs on Windows. Emacs looks for .emacs.d in what it considers the home directory, and on Windows that is not necessarily C:\Users\you. If no HOME environment variable is set, Emacs uses %APPDATA% as home, so your config folder belongs at:
C:\Users\you\AppData\Roaming\.emacs.d\init.el
To check what your Emacs thinks, press C-h v, type user-emacs-directory and press Enter. If you would rather keep the config in your profile folder, set a user environment variable HOME to %USERPROFILE% and restart Emacs. Either choice works; just make it once and stick to it, because a config split across two folders is a confusing way to lose an afternoon.
Check the Emacs version you installed
Inside Emacs, run M-x emacs-version. It prints the version, the build date and the toolkit in the echo area. From a shell, emacs --version does the same.
Run both. On Linux, macOS and Windows alike, it is easy to end up with two copies (a distro package plus a source build, or a cask plus a terminal formula), and the one your desktop launcher opens may not be the one on your PATH. If you want the feature list as well, C-h v system-configuration-features shows what the build was compiled with: look for NATIVE_COMP and TREE_SITTER.
Where the init file lives
Emacs reads your configuration from the first of these it finds:
~/.emacs(a single file, the oldest convention)~/.emacs.d/init.el~/.config/emacs/init.el(the XDG location, supported since Emacs 27)
The order matters. If an old ~/.emacs or an empty ~/.emacs.d/ exists, Emacs uses it and quietly ignores ~/.config/emacs/. Pick one location and delete the others. Buffer Yard’s sample config uses ~/.emacs.d/init.el because every tutorial and package README assumes it, but the XDG path works the same.
Next to init.el you can place early-init.el, also introduced in Emacs 27. It runs before the package system starts and before the first frame is drawn, which makes it the place for settings that should take effect immediately: hiding the tool bar and menu bar so they never flash on screen, raising the garbage collection threshold during startup, or turning off package.el if you use a different package manager.
;; early-init.el
(setq gc-cons-threshold (* 64 1024 1024))
(push '(tool-bar-lines . 0) default-frame-alist)
(push '(menu-bar-lines . 0) default-frame-alist)
Then create init.el with one line so you can see it load:
;; init.el
(message "init.el loaded from %s" user-emacs-directory)
Restart Emacs and check the *Messages* buffer. Seeing that line confirms the path is right on whichever system you used. To quit, C-x C-c closes Emacs and offers to save any modified buffers.
With Emacs running and init.el in the right place, learn the handful of keys you will press a thousand times a day in the essential Emacs keybindings, then add your first packages with MELPA and use-package. If you would rather start from a complete, small configuration, the starter guide walks through it line by line, and the completion setup is the first upgrade most people notice.
Questions readers ask
Which Emacs version should I install?
Take the newest stable release your platform offers, and at least 29.1. That version brought use-package, eglot and tree-sitter modes into Emacs itself, and most current guides assume it.
Should I install Emacs on macOS with emacs-plus or the cask?
The emacs-plus tap gives you more build options and native compilation, so it suits people who plan to live in Emacs. brew install --cask emacs is quicker and fine for trying it out. Both run the same init file.
Where does Emacs on Windows look for my .emacs.d folder?
In the directory Emacs treats as home. Without a HOME environment variable that is usually %APPDATA%, so the folder ends up under AppData\Roaming. Check with C-h v user-emacs-directory.
Do I need both ~/.emacs.d/init.el and ~/.config/emacs/init.el?
No, pick one. Emacs 27 and later read ~/.config/emacs/, but if ~/.emacs.d/ or a ~/.emacs file exists, that wins and the XDG folder is ignored.
How do I check which Emacs I am actually running?
Run M-x emacs-version inside Emacs, or emacs --version in a shell. If the two disagree, your launcher or desktop icon points at a different binary than your PATH does.