Installation
There are several ways to install moonlight, depending on where you use Discord.
moonlight installer
The moonlight installer automates the installation process for you. To use it, download and run the installer, download moonlight through it, and then patch a Discord installation.
Discord installations are autodetected on your machine. Keep the installer in the event that a Discord update breaks moonlight, so you can unpatch Discord or update moonlight.
Download and run moonlight-installer.exe
. Close Discord fully before patching.
Download and run moonlight-installer-macos.dmg
.
After you’ve installed moonlight, read about how to use moonlight:
moonlight-cli
A command line installer can be used to update and patch moonlight. Install Rust, then build the CLI from source:
cargo install --git https://github.com/moonlight-mod/moonlight-installer.git moonlight-climoonlight-cli install stable # or `moonlight-cli install nightly`moonlight-cli patch /path/to/discord/executable
You can specify a custom moonlight dist
directory with moonlight-cli patch -m /path/to/moonlight/dist
.
Manual installations
Manual installations are suggested for those who wish to work on moonlight itself.
- Build moonlight.
- Go to your Discord install’s
resources
folder. - Rename the
app.asar
to_app.asar
, and create anapp
folder. Discord will load the folder instead of the.asar
now that it has been renamed. - Create the following files in
resources/app
:
{ "name": "discord", "main": "./injector.js", "private": true}
require("/path/to/moonlight/dist/injector").inject( require("path").join(__dirname, "../_app.asar"));
Adjust the /path/to/moonlight/dist
to point to the dist
folder in your locally cloned moonlight install.
You should have the following structure:
Directoryresources
- _app.asar
Directoryapp
- injector.js
- package.json
Browser
moonlight can be installed as a browser extension. To use it, manually build moonlight, and then build the browser extension:
- Manifest v3 (Chrome):
pnpm run browser
- Manifest v2 (Firefox):
pnpm run browser-mv2
The output extension will be at dist/browser
. Chrome users can check “Developer mode” and click “Load unpacked” in chrome://extensions
, and Firefox users can click “Load Temporary Add-on” in about:debugging
.
Nix
moonlight offers a nixpkgs package and a flake. It is suggested to use the nixpkgs package, but the flake lets you pick moonlight branches and provides optional home-manager integration.
nixpkgs
User-level installation:
users.users.alice.packages = [ (pkgs.discord.override { withMoonlight = true; })];
System-wide installation:
environment.systemPackages = [ (pkgs.discord.override { withMoonlight = true; })];
flake
{ inputs.moonlight = { url = "github:moonlight-mod/moonlight"; # Add `/develop` to the flake URL to use nightly. inputs.nixpkgs.follows = "nixpkgs"; }}
If you use home-manager, you can import moonlight’s module, and copy your existing moonlight config into your configuration:
{ inputs, ... }:{ imports = [ inputs.moonlight.homeModules.default ];
programs.moonlight-mod = { enable = true; stable = { extensions = { allActivites.enabled = true; alwaysFocus.enabled = true;
betterEmbedsYT = { enabled = true; config = { fullDescription = false; expandDescription = true; }; }; }; }; };}