DEV Community

loading...
Cover image for Installing Doom Emacs on Windows

Installing Doom Emacs on Windows

Scarlett
Updated on ・3 min read

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Set Environment Variables

Go to Settings → System → About → Advanced System Settings → Advanced → Environment Variables…

  1. On User Variables section→ Click on New button… → Set HOME to the variable name and set your path user C:\Users\USERNAME to variable value → Finally click on OK

set user dir in env variables

  1. Also, on User Variables → Select Path Variable and click on Edit button →
    • Add C:\msys64\mingw64\bin (MSYS2) or C:\ProgramFiles\Emacs\x86_64\bin (Executable)
    • Add your C:\path\to\the\ripgrep directory
    • Add your C:\path\to\the\fd directory

Emacs in the environment variables

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Once the installation is done, we need to ensure that the necessary packages are installed:

$ .emacs.d/bin/doom sync
Enter fullscreen mode Exit fullscreen mode

Now you can start Emacs executing the emacs command, and it will display vanilla Emacs:

$ emacs
Enter fullscreen mode Exit fullscreen mode

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\
Enter fullscreen mode Exit fullscreen mode

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"
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Go to the folder where you downloaded the fonts and install manually all the files.

my doom emacs on windows

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

Discussion (0)