Installation
There are several ways to install moonlight. It is suggested to use the installer or CLI if you are not a developer.
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
.
moonlight-cli
A command line installer can be compiled from source manually and used to patch moonlight.
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
After first launch, moonlight will create a config directory in the Electron appData
path named moonlight-mod
:
- Windows:
%AppData%/moonlight-mod
- macOS:
~/Library/Application Support/moonlight-mod
- Linux:
~/.config/moonlight-mod
Each Discord branch has its own .json
file for configuration.
Browser
moonlight optionally runs in the browser. To use it, 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
.
Browser support is experimental and may be unreliable. Developing extensions or using custom repositories is not supported with the browser extension.
Nix
moonlight offers a nixpkgs package and a flake, which has the option to use nightly if the develop
branch is selected and provides declarative home-manager configuration options.
Please leave an issue on the nixpkgs or moonlight repository depending on which one you are using in case of a build failure.
Nixpkgs (recommended)
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"; }}
{ 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; }; }; }; }; };}