How To Install scrcpy On Ubuntu, Fedora, Debian, Linux Mint, elementary OS Or Pop! OS

scrcpy control Android from Linux desktop

scrcpy is a free and open source application to display and control Android devices connected via USB (or wirelessly, but with lower performance) from a Linux, Windows or macOS desktop.

It requires at least Android 5.0, and adb debugging enabled on the Android device. Root access is not required.

scrcpy focuses on lightness, performance and quality, offering 30~60 FPS, with a resolution of 1920x1080 or more. It also has a low latency, somewhere between 70 and 100 ms. I must say scrcpy's performance surprised me when I first tried it, it almost felt like I was having the Android device in my hand, and not using it remotely from my Linux desktop computer.

The communication between the server (Android device in this case) and client (desktop computer) is done via a socket over an adb tunnel. The server streams H.264 video of the device screen, passing it to the client to decode and display it, without buffering in order to minimize latency. The mouse and keyboard events are captured and transmitted to the server, which injects them to the Android device.

Features:

  • Control Android devices from a desktop (with a mouse and keyboard) running Linux, Windows or macOS
  • Works over USB or WiFi (though the performance decreases when using it over WiFi)
  • Allows recording the Android screen while mirroring
  • It's possible to limit the Android mirroring resolution width and height
  • Allows changing the video bit-rate
  • The device screen can be cropped
  • Can mirror multiple devices in the same time
  • The scrcpy application can be started directly in fullscreen
  • For presentations, scrcpy can show physical touches on the Android device (only physical touches, with finger on the device!)
  • Install APK by dragging and dropping it onto the scrcpy window, or push a file to the device /sdcard by dragging and dropping a non-APK file
  • Read-only mode to disable interacting using input keys, mouse events and drag&drop

Audio forwarding doesn't work, this being a limitation of the Android Open Accessory Protocol. Edit: With scrcpy 2.0, audio forwarding is also supported!

If you feel the quality is not the best (with fonts or gradients for instance), that's most probably because the screen is scaled down. Switch the Android device to landscape mode, and run scrcpy in fullscreen (Ctrl + F) for better quality.

It's also worth noting that the "scrcpy" name comes from "screen copy". That should make it easier to remember 😁️.

scrcpy can be downloaded from https://github.com/Genymobile/scrcpy, the developers offering precompiled binaries for Microsoft Windows, and a Homebrew package for macOS. There's an Arch Linux AUR package, and a Gentoo Ebuild available too.

Android-related:


Install scrcpy on Ubuntu, Fedora, Debian, or Linux Mint


scrcpy control Android from Ubuntu, Fedora or Debian

[[Edit]] scrcpy is now in the official Pop!_OS / Ubuntu 20.04, 20.10 and 21.04 repositories (and Linux Mint 20.x), as well as in Debian Sid (but it might not be the latest version). Install it using:

sudo apt install scrcpy

[[Edit]] scrcpy can now be installed on Fedora using a Copr repository. Add the repository and install it as follows:

sudo dnf copr enable zeno/scrcpy
sudo dnf install scrcpy

The instructions below are for building scrcpy and installing it from source, on Debian / Ubuntu / Linux Mint and Fedora. This way you can install the latest version, no matter what version of Debian / Ubuntu / Linux Mint or Fedora you're using.

I found the official scrcpy build instructions for Linux to be a bit confusing, so I decided to try to make them more straightforward. There is a new, unofficial scrcpy snap package available in the Snap store, but it didn't work on my Ubuntu 18.10 desktop, so it probably still needs some work. The scrcpy package now works, so you can install the application easier by using the scrcpy snap package.

I tried the steps below, and scrcpy itself on Ubuntu 22.10 and 22.04 (and originally on Ubuntu 18.10 and 18.04), and Fedora 37 (initially on Fedora 29). Since Ubuntu is based on Debian, and Linux Mint on Ubuntu, it should also work on those, and other Linux distributions based on Debian or Ubuntu.

1. Install dependencies needed to build and run scrcpy on Debian, Ubuntu and Linux Mint, or Fedora.

  • Debian, Ubuntu or Linux Mint:
sudo apt install adb ffmpeg libsdl2-2.0-0 make gcc pkg-config meson ninja-build libavcodec-dev libavformat-dev libavutil-dev libsdl2-dev libusb-1.0-0-dev libavdevice-dev

  • Fedora (first command enables the RPMFusion repository - skip if it's already enabled on your Fedora machine):
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm

sudo dnf install android-tools ffmpeg SDL2-devel ffms2-devel meson gcc make libavdevice libusb1-devel

It's worth noting that Meson 0.37 or newer is required (if you're on Ubuntu 16.04, enable the Backports repository to be able to install a newer Meson version). As opposed to the official build instructions, OpenJDK is not included in my guide because it uses the precompiled scrcpy-server jar, to make things easier.

These are the only distro-specific instructions, so if you know how to install these dependencies (which may have different names depending on the Linux distribution you're using) for some other Linux distribution, the other steps should be the same.

2. Download and install the scrcpy server jar.

Download the latest scrcpy-server-v*.jar from the application releases page, and place it in your home folder. If the file doesn't have the .jar extension, rename it and add it yourself.

Next, install it to /usr/local/bin (even though it will also be installed in /usr/local/share/scrcpy, for some reason scrcpy searches for it in /usr/local/bin):

sudo install scrcpy-server-v*.jar /usr/local/bin/scrcpy-server.jar

3. Download the latest scrcpy release source code and extract it in your home folder.

Download the scrcpy source code (the .tar.gz archive, for example) from the application releases page, and extract it in your home directory in a folder called scrcpy (remove the version number from the scrcpy folder name – this makes it easier to use these instructions with future scrcpy versions).

The home folder should now have a file called scrcpy-server-v*.jar (e.g. scrcpy-server-v2.0.jar for scrcpy v2.0), and a folder called scrcpy.

4. Build and install scrcpy.

To build scrcpy, we'll navigate to the scrcpy folder, build the application, and install it:

cd scrcpy

meson build --buildtype release --strip -Db_lto=true  -Dprebuilt_server=../scrcpy-server-v2.0.jar

cd build

ninja

sudo ninja install

If you're installing a different scrcpy version, replace scrcpy-server-v2.0.jar from the second command with the exact filename containing the version you're installing.

You may now remove the scrcpy folder from your home directory if you wish.

How to use scrcpy on Linux to control an Android device from the Linux desktop (or record its screen)


I already mentioned this in the beginning of the article, but I think I should say it again. You need an Android 5.0 or newer device to control it from the desktop using scrcpy. What's more, make sure you enable adb debugging on your Android device. On some devices you may also need to enable an additional "USB debugging (Security settings)" option to be able to control the Android device from your desktop computer.

To use scrcpy, connect your Android device to your computer via USB, then run scrcpy in a terminal:

scrcpy

If you didn't authorize the current computer with your Android device using adb, when running scrcpy for the first time make sure the Android device screen is unlocked, and that you authorize scrcpy (click OK on the Android device when asked for authorization)!

It's also worth noting that in my case, on a computer where I didn't run adb before, I had to run scrcpy 3 times until it worked (it probably doesn't wait enough time for the authorization), so you may want to do this as well, in case it doesn't work immediately:

logix@logix22:~$ scrcpy
* daemon not running. starting it now on port 5037 *
free(): invalid next size (fast)
ADB server didn't ACK
* failed to start daemon *
adb: error: connect failed: cannot connect to daemon
ERROR: "adb push" returned with value 1

logix@logix22:~$ scrcpy
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
adb: error: connect failed: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
ERROR: "adb push" returned with value 1

logix@logix22:~$ scrcpy
[100%] /data/local/tmp/scrcpy-server.jar
INFO: Initial texture: 1440x2560

Want to record the Android screen, while controlling the Android device using your desktop (with a keyboard and mouse)? Run scrcpy with --record followed by the filename to record to, with either mkv or mp4 as the extension. E.g.:

scrcpy --record file.mp4

You may be wondering how to return to the previous screen on the Android device when controlling it from the desktop, go to the home screen, or use the app switcher, for devices with physical keys - you can use some shortcuts:

  • Mouse right-click or Ctrl + b (or Ctrl + Backspace) for BACK
  • Mouse middle-click or Ctrl + h (or the Home button) for HOME
  • Ctrl + s for the app switcher

For how to control the Android device wirelessly from your desktop, see the detailed instructions on the application project page. Also see the scrcpy page for more advanced usage, like reducing the mirrored screen size, change the bit-rate, crop the screen, or running multiple scrcpy instances with multiple Android devices.

How to uninstall scrcpy (installed from source)


Users wanting to remove scrcpy installed from source (using the instructions in this article), can run these two commands:

sudo rm /usr/local/share/scrcpy/scrcpy-server.jar
sudo rm /usr/local/bin/scrcpy-server.jar
sudo rm /usr/local/bin/scrcpy