You heard about something called Emacs and a couple of searches later you decided that you were going to try Doom Emacs for the first time, but… Oh, No — Most of the guides show how to make the installation just on Linux— So you think, where do I begin?
If this is your case, let me show you how I install Doom Emacs on Windows.
Previous Requiriments
- Git
- Ripgrep → Download the windows-gnu version → Unzip the content to a safe directory.
- fd → Download the windows-gnu version → Unzip the content to a safe directory.
Installing Emacs (Vanilla)
To get Emacs on Windows, you have two mainly options. Through MSYS2 or with an Emacs executable (.exe).
The way that I recommend if you don't have a lot of experience working with Unix/Linux is to directly download the executable from a nearby GNU mirror and install it like an another program in windows.
If you are a MSYS2 user, in MSYS2 you have to use the follow command:
$ pacman -S mingw-w64-x86_64-emacs
Emacs GUI will be at C:\msys64\mingw64\bin\runemacs.exe
Creating an Emacs Files Backup (Optional)
If you installed emacs using the executable, in HOME directory rename the .emacs.d
or if you are using MSYS2 the configuration files are in C:/Users/Scarlett/AppData/Roaming/
Renaming the .emacs.d directory:
$ mv .\.emacs.d\ .\.emacs.d.old
Set Environment Variables
Go to Settings → System → About → Advanced System Settings → Advanced → Environment Variables…
- On
User Variables
section→ Click on New button… → Set HOME to the variable name and set your path userC:\Users\USERNAME
to variable value → Finally click on OK
- Also, on User Variables → Select Path Variable and click on Edit button →
- Add
C:\msys64\mingw64\bin (MSYS2)
orC:\ProgramFiles\Emacs\x86_64\bin (Executable)
- Add your
C:\path\to\the\ripgrep
directory - Add your
C:\path\to\the\fd
directory
- Add
Note: You don’t need to restart the system but the console (MSYS2, git bash, powershell…)
Installing Doom Emacs
At this point we should have a vanilla Emacs running correctly in our system, so in the next steps we are going to do a clean installation of Doom Emacs, also I will show you how to do that with both kind of Emacs installation that we have been seeing.
If you installed Emacs with the executable (.exe)
Open PowerShell or gitbash.exe to install Doom. Make sure that you are in your user directory, then clone doom:
$ git clone https://github.com/hlissner/doom-emacs .emacs.d
$ ~/.emacs.d/bin/doom install
Note: If the powershell or gitbash prompt: fatal: destination path 'C:/Users/Scarlett/.emacs.d' already exists and is not an empty directory.
We need to remove the.emacs.d
directory
Once the installation is done, we need to ensure that the necessary packages are installed:
$ ~/.emacs.d/bin/doom sync
If you installed Emacs with MSYS2
Inside the C:/Users/your user/AppData/Roaming/
directory, clone and install doom:
$ git clone https://github.com/hlissner/doom-emacs .emacs.d
$ .emacs.d/bin/doom install
Once the installation is done, we need to ensure that the necessary packages are installed:
$ .emacs.d/bin/doom sync
Now you can start Emacs executing the emacs
command, and it will display vanilla Emacs:
$ emacs
As you can see, apparently the doom installation is not working, however, we need to take one more step:
We have to remove the .emacs.d
directory created when we ran Emacs:
$ rm C:\Users\USER\.emacs.d\
We need to create a symbolic link. For that, run cmd as administrator and execute the following command (remember change ‘USER’ on the path):
$ mklink /j "C:\Users\USER\.emacs.d" "C:\Users\USER\AppData\Roaming\.emacs.d"
Installing the Icons
Finally, if you don’t see the icons, you will need to install them, in Emacs type M-x (Alt + x) and write the following:
all-the-icons-install-fonts
Go to the folder where you downloaded the fonts and install manually all the files.
As you can see, there are more than one way to install Doom Emacs on Windows. If you know others, share in the comments for everyone!
I hope this post has allowed you to start exploring the Emacs world.
Thanks For Reading, Follow Me For More
Top comments (8)
A minor correction I'd like to suggest. When the emacs is installed with the executable (and not msys2), the ".emacs.d" config folder resides in the "C:\Users\Username\AppData\Roaming" folder and not the user home folder. So, the doom commands (like cloning the doom repo), should be run from this folder.
Thanks for this. Will get this setup on my windows machine. I've been wanting to use Doom on the PC for ages now!
I have been using doom on a mac but wanted to use it on win 10 too.
Emacs installed well by using the suggested ".exe" file. My verison is 28.2
Getting doom from git seems to work
git clone github.com/hlissner/doom-emacs .emacs.d
Issue involves getting the sync done which would hopefully allow emacs to sytart in Doom mode rather than the standard emacs.
I use powershell so tried running .\doom sync as well as doom sync with an error about 'emacs' not being recognized.
.
Not sure what I have done incorrectly.
Do I need to edit the doom script in some way?
Tks...Dave
Hello Dave,
To me it appears that your issue is the 'emacs' command is being run by the script and the environment is subsequently unable to recognize it.
The problem is likely that your msys2 directory or whichever directory contains your mingw emacs bin is not contained within your path; The script is structured assuming you have already done this.
Just add
or wherever your emacs binary is located into your PATH and this script should work as expected.
This can be done through the GUI in "Edit the system environment variables" or done quickly and temporarily in your PS environment by running
(Substitute your actual bin parent dir)
P.S.
You must run
before
Additionally, it would be a good idea to add your doom bin directory to your path so you can also access your doom script options globally at your leisure. The doom emacs wiki also recommends this.
Minor note, in case someone spots the difference: It's now more common to clone the doom-emacs repo to .config/emacs, thus also having the doom .el files in .config/doom. I'm a noob, so all I know is that removes some clutter in $HOME.
Thanks.
Thank you.
Dunno if things have changed or I missed something, but I had no icons until I installed "nerd-icons-install-fonts"