Moonshine lets you stream games from your PC to any device running Moonlight. Your keyboard, mouse, and controller inputs are sent back to the host so you can play games remotely as if you were sitting in front of it.
- Isolated streaming sessions: Each stream runs in its own compositor, completely separate from your desktop environment. Your host PC can still be used for other things while you stream.
- No monitor required: Works on headless servers — no HDMI dummy plug needed.
- Hardware video encoding: H.264, H.265, and AV1 encoding using the GPU.
- HDR support: True 10-bit HDR streaming for supported games.
- Full input support: Mouse, keyboard, touchscreen, pen/stylus, and gamepad (including motion, touchpad, and haptics).
- Audio streaming: Stereo and surround sound (5.1/7.1) with low-latency Opus encoding.
- Web control panel: Pair devices, manage applications, change settings and watch live stream statistics.
- Stream in the browser: Play from the control panel in Chrome, Edge or Firefox, with nothing to install.
- Install Moonshine with the install script.
- Open the control panel at http://localhost:47990 .
- In Moonlight, select the host (or add it by its IP address). Moonlight shows a PIN.
- Type the PIN on the Clients page of the control panel.
- Select Steam (or a game) in Moonlight to start streaming.
- Linux only, x86_64, with glibc 2.39 or newer (for example Ubuntu 24.04+, Debian 13+, Fedora 40+).
- systemd. Required for launching and managing application processes. Almost all modern Linux distributions include it by default.
- A GPU with Vulkan video encoding. NVIDIA RTX, AMD RDNA2+, or Intel Arc.
- Moonlight v6.0.0 or higher. Compatibility with older versions or unofficial ports is not guaranteed.
Run the install script as your normal user (not with sudo). It asks for sudo when it needs it:
curl -fsSL https://github.com/hgaiser/moonshine/releases/latest/download/moonshine-install.sh | bashThe script picks the installation method for your system:
| System | Method |
|---|---|
| Arch, CachyOS, EndeavourOS, Manjaro, ... | The moonshine-bin AUR package, with paru, yay or makepkg |
| Debian, Ubuntu, Linux Mint, Pop!_OS, ... | The release .deb, with apt |
| Fedora, Nobara, ... | The release .rpm, with dnf |
| Bazzite, Silverblue, Kinoite and other Fedora Atomic distros | The release .rpm, layered with rpm-ostree (reboot after install) |
| SteamOS, and every other distro | The release tarball, unpacked into /opt/moonshine |
| NixOS | Nothing: use the NixOS module |
It checks each download against the release's SHA256SUMS. It then offers to do the steps in Enable the service for you.
- Upgrade: run the script again. It keeps the method of the current installation.
- Uninstall:
curl -fsSL https://github.com/hgaiser/moonshine/releases/latest/download/moonshine-install.sh | bash -s -- --uninstall - Preview: add
--dry-runto see the method and the commands, without changes. - Choose the method: add
--method aur|deb|rpm|ostree|opt.
Run the script with --help for all options.
Download the package from the releases page, install it, then do the steps in Enable the service.
| System | Command |
|---|---|
| Arch | yay -S moonshine-bin |
| Debian / Ubuntu | sudo apt install ./moonshine_*.deb |
| Fedora / RHEL | sudo dnf install ./moonshine-*.rpm |
| Fedora Atomic (Bazzite, Silverblue, ...) | sudo rpm-ostree install ./moonshine-*.rpm, then reboot |
To build from source, see Building from source.
Moonshine and its services.moonshine module are in nixpkgs. The module does all the steps in Enable the service, so skip them.
services.moonshine = {
enable = true;
user = "alice"; # must be declared in users.users
# Required: the default application points at /usr/bin/steam, which doesn't exist on NixOS.
settings.application = [
{
title = "Steam";
command = [ "/run/current-system/sw/bin/steam" "-steamos3" "steam://open/bigpicture" ];
steam_integration = true;
}
];
# Opens the ports on these interfaces only; see Security below.
# firewallInterfaces = [ "tailscale0" ];
};See all options at search.nixos.org. This repository is also a flake that builds the latest commit. See nix/README.md.
The install script and the NixOS module do these steps for you. Do them yourself after a manual installation.
-
Enable user lingering, so Moonshine can run applications when you are not logged in:
sudo loginctl enable-linger $USERIf you are always logged in when you stream, you can skip this step.
-
Start the service now and on boot:
sudo systemctl enable --now moonshine@$USER
-
Gamepad support when streaming headless (no active desktop session): add your user to the
inputgroup, then log out and back in:sudo usermod -aG input $USERThe streamed game must be able to read the virtual gamepads that Moonshine creates. With an active desktop session, your user already has this access, so you can skip this step.
The service reads ~/.config/moonshine/config.toml. Moonshine creates this file on the first start.
The default configuration streams Steam Big Picture and finds your installed Steam games, so most users do not have to change anything.
Moonshine has a web control panel at http://localhost:47990 . With it you can:
- See the stream that runs now, with live graphs of latency, bitrate and frame rate, and stop it.
- See the health checks, and run them again.
- Pair new devices with their PIN, and rename or unpair paired devices.
- Add and edit applications and scanners, and hide scanned applications from clients.
- Change settings. Each setting shows if it applies now, at the next stream, or after a restart.
- Read the logs, and download a report for bug reports.
- Stream an application in this browser (see Streaming in the browser).
The control panel writes its changes to config.toml and keeps your comments in place.
By default, only this computer can open it. To open it from other devices, add their address range:
[ui]
allowed_networks = ["127.0.0.1/32", "::1/128", "192.168.1.0/24"]Warning
Anyone who can open the control panel can add applications, which run commands as your user. Only add address ranges that you trust. The control panel has no password.
Set enabled = false in the [ui] table to turn the control panel off.
To open it through a reverse proxy, see TIPS.md.
Select play at the top of the control panel, or open http://localhost:47990/play . It works in Chrome, Edge and Firefox.
The advanced options set the resolution, frame rate, bitrate, HDR, video codec, audio channels and the captured mouse (raw for games, or accelerated for desktop work). By default, the stream uses the size of the screen, 60 fps and the bitrate that Moonlight would use. HDR, the codec and the audio are automatic: the stream uses what both this computer and the browser support. Turn on Remember these options for this application to use other options for one application, for example a lower resolution for a demanding game. Only Chrome and Edge show HDR in HDR. Show statistics shows the frame rate, bitrate, decode time, round trip and loss on top of the stream; Ctrl+Alt+Shift+S shows or hides them during the stream.
- The stream uses UDP port 47990: open it in the firewall.
- From other devices, the page uses HTTPS with a self-signed certificate, so the browser warns the first time. To use your own, set
certificateandprivate_keyin[ui]. - To turn it off, set
streaming = falsein[ui].
When you connect with Moonlight for the first time, it shows a PIN. Type it on the Clients page of the control panel. You can also click the notification on the host, or open http://localhost:47989/pin . To pair without a browser, see TIPS.md.
Each application runs in its own isolated streaming session. Add them in the control panel, or in config.toml:
[[application]]
title = "Steam"
command = ["/usr/bin/steam", "-steamos3", "steam://open/bigpicture"]
boxart = "/path/to/steam.png"
steam_integration = true
pre_command = [
["/usr/bin/systemctl", "stop", "conflicting.service"],
]
post_command = [
["/usr/bin/systemctl", "start", "conflicting.service"],
]title: The name shown in Moonlight.command: The command to run. The first entry is the executable, the rest are arguments.boxart(optional): Path to a cover image.working_directory(optional): The directory to start the application (and itspre_commandandpost_command) in.~and environment variables are expanded. The directory must exist. Defaults to your home directory.steam_integration(optional): Turn it on for Steam Big Picture, so its overlay and focus work. Leave it off for everything else. Off by default.pre_command(optional): Commands to run before the application starts. They run in order, outside the sandbox, and the session waits until they finish (at most 90 seconds each). If one fails, the application does not start.post_command(optional): Commands to run after the application stops. They run in order, outside the sandbox (at most 90 seconds each). The session does not wait for them.profile(optional): Run the application with a home folder of its own,~/.local/share/moonshine/profiles/<profile>. For example, Steam in the stream can then use another account than Steam on the desktop.host_gamepads(optional): Also give the application the controllers that are connected to this computer, not only the stream's gamepads. Off by default.stdout,stderr(optional): Where the application's output goes:null(the default),journal,inherit(Moonshine's own output),file:<path>,append:<path>ortruncate:<path>.
See TIPS.md for practical recipes with these fields.
Scanners find installed applications, so you don't have to add them one by one:
- Steam: installed Steam games (on by default).
- Desktop: applications from
.desktopfiles. - Lutris, Heroic, Bottles and Faugus: games from these launchers.
[[application_scanner]]
type = "steam"
library = "$HOME/.local/share/Steam"
command = ["/usr/bin/steam", "-steamos3", "-bigpicture", "steam://rungameid/{game_id}"]See SCANNERS.md for the options of each scanner.
Moonshine runs each application in a sandbox made with bubblewrap:
- A game sees only the gamepads of its own stream, not the computer's own controllers (unless the application has
host_gamepads = true). - With the rules
60-moonshine.rulesand72-moonshine-isolation.rulesinstalled (the packages do this), the desktop's user does not get the stream's gamepads either. Steam Input's virtual controllers stay in the stream too. - Stopping a stream stops every process of the application, also processes that run in the background.
- Applications can have a
profile.
More device nodes for the applications, if the sandbox hides them:
[sandbox]
devices = ["/dev/uhid"]Moonshine needs bubblewrap, and unprivileged user namespaces must be allowed. Moonshine does not start without them; moonshine healthcheck shows the cause. On Ubuntu, the .deb installs an AppArmor profile that allows them. The sandbox is not a security boundary: it keeps well-behaved games away from the wrong controllers.
See TIPS.md for the details and the requirements.
- Run
moonshine healthcheckto check the GPU, codec support and ports. Add--config ~/.config/moonshine/config.tomlto also check your configured ports and GPU. - Read the logs with
journalctl -u moonshine@$USER, or on the Logs page of the control panel. - If an application does not start, see Debug a failing application.
- When you report a bug, attach the report from the Logs page of the control panel.
-
How does this compare to Sunshine?
Sunshine supports more platforms and has more features. Moonshine is Linux-only, and runs each stream in its own compositor instead of capturing your desktop.
-
Can I use Moonshine to stream to two clients simultaneously?
This is currently not a supported feature and not a focus of Moonshine. If you are interested in adding support for this, feel free to open an issue or discuss on Discord.
Moonshine is not designed for use on public networks. Do not expose Moonshine ports directly to the internet. The underlying GameStream protocol has limitations that mean traffic is not fully encrypted at the application level.
If you need to stream over the internet, use a VPN such as Tailscale, WireGuard, or ZeroTier.
These commands are for Arch Linux. Other distributions have the same packages under similar names.
# Build dependencies
sudo pacman -S clang cmake jq libc++ rust
# Runtime dependencies
sudo pacman -S gcc-libs glibc libevdev libxkbcommon mesa opus wayland xorg-xwayland bubblewrapBuild:
cargo build --release --workspaceSet up the environment:
# Install the uinput, uhid and cuse kernel modules
sudo install -Dm644 dist/moonshine-modules.conf /usr/lib/modules-load.d/moonshine.conf
sudo modprobe -a uinput uhid cuse
# The moonshine group: it gets the stream's gamepads and /dev/cuse, and it may
# keep the computer awake while streaming (run Moonshine with this group, or add
# your user to it)
sudo groupadd --system moonshine
sudo install -Dm644 dist/50-moonshine-inhibit-sleep.rules /etc/polkit-1/rules.d/50-moonshine-inhibit-sleep.rules
# Install udev rules for input device access and Moonshine's uinput proxy, and the
# rule that keeps the stream's gamepads away from the desktop's user (see TIPS.md).
# A copy in /etc overrides a package's copy in /usr/lib: remove it if you install a
# package later.
sudo install -Dm644 dist/60-moonshine.rules /etc/udev/rules.d/60-moonshine.rules
sudo install -Dm644 dist/72-moonshine-isolation.rules /etc/udev/rules.d/72-moonshine-isolation.rules
sudo udevadm control --reload-rules
sudo udevadm trigger
# Ubuntu only: allow the sandbox to use user namespaces (see TIPS.md)
sed "s|/usr/bin/moonshine|$PWD/target/release/moonshine|" dist/moonshine.apparmor | sudo tee /etc/apparmor.d/moonshine >/dev/null
sudo apparmor_parser -r /etc/apparmor.d/moonshine
# Install ferriscope's Vulkan WSI layer for game rendering
dist/install-wsi.sh # builds as you, asks for sudo only to installRun:
cargo run --release -- /path/to/config.tomlBug reports and pull requests are welcome on GitHub. See CHANGELOG.md for the changes in each release.
This wouldn't have been possible without the incredible work by the people behind the following projects:
- Moonlight, without it there would be no client for Moonshine.
- Sunshine, which laid a lot of the groundwork for the host part of the API.
- Inputtino, for a thorough implementation of input devices.
- magic-mirror, for inspiration of using Vulkan and a Wayland compositor for headless streaming.
Moonshine is licensed under the BSD 2-Clause License.



