An RDP host for macOS v1.0.9

Your Mac, on another computer. With its sound.

A remote desktop program on the other computer, Remmina on Linux, shows the Mac’s screen, sends your keyboard and mouse to it, and plays its sound, well enough to watch a video that plays on the Mac. mardp speaks RDP, so the other computer needs nothing special.

Install it GitHub Documentation

The window of mardp at the first start. It says Stopped, and shows a checklist with Screen Recording, Accessibility and User name and password, beside the settings The checklist with Screen Recording and Accessibility granted, and the form for the user name and the password open in the settings The window while it listens, with the address 192.168.1.20:3389 to type into Remmina and the fingerprint of the certificate The window while a client is connected, with the name and address of the client, the size of the desktop, Video H.264 (AVC420), Sound AAC, the frames a second, the bitrate and the delay

A checklist leads you through what macOS asks for. The pictures of the window are drawn by the app itself, with example data.

You set a user name and a password that are only for mardp. The other computer logs in with them.

After Start, the window shows the address to type into Remmina and the fingerprint that proves you reached your own Mac.

While someone is connected, the window says who, how the picture is sent, the frames a second, the bitrate and the delay. The values of this picture are examples.

60 fps

frames a second at 1920×1080 reach the client in the project’s own test, together with the sound

6.1 ms

is what the Mac adds, from the capture of a frame to its last byte on the socket, for 95% of the frames

14.9 %

of one core is what mardp uses during that test

77 MB

of memory during the test, and it does not grow in 30 minutes

  • It speaks RDP

    RDP is the protocol Remmina already knows. You install nothing special on the other computer. You make a connection profile and type an address.

  • Good enough for video

    The picture is H.264 from the Mac’s hardware encoder, and the sound is AAC. An idle desktop costs almost nothing, because no frame is captured, encoded or sent while nothing on the screen changes.

  • Its own RDP server, in Go

    mardp contains its own RDP server library, written in Go from scratch, with no code from FreeRDP, xrdp or IronRDP. The window is built with Glutter.

Made for watching video

Play the video on the Mac, full screen, and watch it in Remmina. For video mardp sends H.264, which Remmina decodes with the processor of the Linux computer. In Remmina’s profile the Colour depth must be GFX AVC420 (32 bpp), and mardp’s window then says Video: H.264 (AVC420) through the graphics pipeline.

  • Height cap: 1080 makes the work lighter when the Mac’s screen is larger than that
  • Frame rate cap: 30 is enough for films, which are 24 to 30 frames a second
  • A lower Bitrate cap helps on a slow network, such as Wi-Fi far from the router
  • On Fedora, check that the real OpenH264 is installed, and not its empty stand-in
# Fedora: which of the two packages do you have?
$ rpm -q openh264 noopenh264
# If it says that noopenh264 is installed, swap it for the real one
$ sudo dnf swap noopenh264 openh264 --enablerepo=fedora-cisco-openh264

From a new Mac to a session

The tutorial in the repository goes through these steps one by one, with pictures. It needs about 15 minutes.

The first start

A checklist for what macOS asks

macOS has to allow two things, and mardp cannot allow them to itself. The checklist shows the state of each, and its buttons open System Settings at the right place.

  • Screen Recording, so that mardp can show the screen and capture the sound
  • Accessibility, so that the keyboard and mouse of the other computer work on the Mac. Without it you can only watch
  • User name and password, of at least 8 characters
The checklist Before the server can start, with three open items and a button under each

Login

A password that is only for mardp

The other computer logs in with a user name and a password that you set in the window. They are not those of your Mac account. The password is stored as a hash, never in clear text and never in a log.

  • There is no default password, and the server does not start until one is set
  • After 5 failed logins from one computer, that computer waits 1 minute, then longer each time, up to 1 hour
  • Failed logins are in the list of recent events
The fields User name and Password with the buttons Save and Cancel, in the settings of mardp

Connect

An address and a fingerprint

The connection is encrypted with TLS, and the certificate is made on your Mac at the first start. At the first connection Remmina shows a certificate and asks whether to accept it. Compare its fingerprint with the one in mardp’s window.

  • Colour depth: GFX AVC420 (32 bpp)
  • Advanced, Audio output mode: Local, to hear the Mac’s sound on the Linux computer
  • Advanced, Security protocol negotiation: Automatic negotiation or TLS
The state Listening with the address for Remmina and the SHA-256 fingerprint of the certificate

The session

The window says how the session goes

The state is Stopped, Listening or Connected. While someone is connected, the window shows who, since when, the size of the desktop, how the picture is sent, the frames a second, the bitrate, the sound format and the delay, and a Disconnect button.

  • Recent events lists the last 50 connections, disconnections with their reason, and failed logins
  • mardp keeps the display awake during a session
  • The settings are in the same window, and each group says when its changes apply
The state Connected with the client linux-desktop, a desktop of 1920×1080, 60 frames a second, a bitrate and a delay, and the event of the connection under it

When something is wrong

A log file, and a server without a window

The README has a table of what you may see and what to do about it. For a closer look, start mardp with a log file and read it. mardp -headless runs the server without a window, with the same settings.

# Start mardp with a log file
$ open -n /Applications/mardp.app --args -log-file /tmp/mardp.log
# Which version is installed?
$ /Applications/mardp.app/Contents/MacOS/mardp -version

Text is sharp again when the screen stops

While something moves, the picture is softer. That is what a bitrate is. When the screen stops, mardp goes on sending the picture until it is sharp, within a second or so at 8 Mbit/s and within a few seconds at 2 Mbit/s. These are parts of the pictures of the project’s test of the encoder at 2 Mbit/s, decoded on the Mac as a client decodes them.

Using it

The settings are in the window, with nothing to scroll.

  • Sound where you want it

    Off, on the client only, or on both the client and the Mac. With the client only, the Mac itself stays silent.

  • Swap Ctrl and Command

    Ctrl on the Linux keyboard then acts as Command on the Mac, so Ctrl+C copies.

  • Copy and paste text

    Text copied on one computer can be pasted on the other, both ways. Only text travels, not pictures or files.

  • It runs without its window

    Closing the window does not stop mardp. It keeps running, with an icon in the menu bar that has Start or Stop, Disconnect, Show window and Quit.

  • Reachable after every login

    With “Open the app at login” and “Start the server when the app opens” both on, you do not have to touch the Mac.

  • One client at a time

    A second connection takes over from the first.

  • Which screen, and how large

    Choose the display on a Mac with more than one, and send a smaller picture than the screen with the height cap, for example 1080 on a 4K display.

  • A new certificate when you ask

    mardp makes a new certificate only when you press “New certificate”. Remmina then asks you to accept the new fingerprint.

Measured on one Mac

Each number has a target in the specification and a script that repeats the measurement.

WhatTargetMeasured
Frames delivered to the clientat least 57 of 60 a second60.0 a second
Delay the Mac adds, from capture to written, for 95% of the framesat most 25 ms6.1 ms
From the connection to the first pictureunder 2 s0.26 s
CPU of mardp during the videounder 60% of one core14.9%
CPU of mardp with a client connected and a still screenunder 2% of one core0.03%
Memory of mardp during the videounder 300 MB, not growing77 MB, and at most 78.6 MB in 30 minutes
Bitrate, with a cap of 20 Mbit/sat most the cap18.5 Mbit/s
Soundno dropout in 10 minutesevery block confirmed in 30 minutes

On an Apple M6 with macOS 27.2, at 1920×1080. mardp encodes a moving test pattern at 60 frames a second, and the project’s own test client connects on the same Mac, so the network is not in these numbers. The same measurements with Remmina over a home network are still pending. The method and every number are in docs/PERFORMANCE.md.

The RDP server is a library

The package rdp of the repository is the server side of RDP, and other Go programs may import it. It imports only the standard library and my errors package, so it builds and its tests run on any system. The app gives it the encoded picture and sound, and gets the input of the client from it.

  • TLS only, with Go’s crypto/tls
  • H.264 inside the graphics pipeline of RDP, with bitmaps as the fallback
  • Sound as AAC, or as 16-bit PCM for a client without AAC
  • Keyboard, mouse, wheel, the shape of the pointer, and the text of the clipboard
  • No cgo and no macOS code
cert, err := tls.LoadX509KeyPair("cert.pem", "key.pem")
if err != nil {
	log.Fatal(err)
}
srv, err := rdp.NewServer(rdp.Config{
	Certificate:   cert,
	Authenticator: rdp.StaticAuthenticator("manos", "a long password"),
	Handler: rdp.HandlerFunc(func(ctx context.Context, s *rdp.Session) {
		w, h := s.DesktopSize()
		log.Printf("%s connected, %d×%d", s.Client().Name, w, h)
		// The picture goes out with s.Video(), the sound with
		// s.Audio(), and the input comes in with s.SetInputSink.
		<-ctx.Done()
	}),
})
if err != nil {
	log.Fatal(err)
}
l, err := net.Listen("tcp", ":3389")
if err != nil {
	log.Fatal(err)
}
log.Fatal(srv.Serve(context.Background(), l))

Built on Glutter

The window of mardp is built with my own GUI toolkit.

What mardp does not do

Better to read it here than to find it out.

  • It does not protect you from someone who knows the password. That person controls the Mac as you do. Use a password that you use nowhere else.
  • It is meant for a local network. Do not open its port to the internet. The certificate is self-signed, so only the comparison of the fingerprint shows that you talk to your Mac.
  • It cannot show the Mac’s login window, because it runs inside your logged-in session. What a client sees while the Mac is locked is still being checked.
  • Coloured text and thin coloured lines look soft with H.264 as Remmina decodes it. For sharp text, Remmina’s Colour depth GFX RFX (32 bpp) makes mardp send the picture without loss, at the cost of much more bandwidth and slower video.
  • One client at a time, and one display in a session. No files, printers or drives, and not the microphone of the client.
  • It is not in the App Store and has no installer to download. The Mac builds the app from the source. It needs macOS 14 or newer, and it is tested on Apple silicon only.
  • From time to time macOS asks again whether mardp may record the screen. That question has to be answered at the Mac itself.

Under the hood#

mardp captures the screen and the system sound with ScreenCaptureKit, which delivers a frame only when the screen changes. The Mac’s hardware encoder turns the frames into H.264 through VideoToolbox, and the sound becomes AAC. Both go to the client inside RDP, over TLS.

The pointer is not drawn into the picture. Its shape and position are sent on their own, so the client draws it with no delay.

The RDP server is a library of the repository (rdp/), written in Go from scratch after Microsoft’s published documents. It has no cgo and no macOS code. The frameworks of macOS are called from the packages under internal/mac only.

macOS ties the Screen Recording and Accessibility permissions to the signature of an app. The installer therefore makes one signing identity for your Mac and signs every build with it, so that an update does not make macOS ask for both permissions again.

The tutorial in the repository goes through the whole setup step by step, with pictures.

Kind
Application
Language
Go
Runs on
macOS
License
BSD-3-Clause
Version
v1.0.9
The icon of mardp: a screen on a stand, with a mouse pointer on it

About 15 minutes on a new Mac

Download the newest version from the tags of the repository, and run one command in Terminal. It says in plain words what is missing, builds the app, copies it into Applications and opens it. Nothing here needs programming.

Source on GitHub Documentation

# Go into the folder that the download unpacked
$ cd ~/Downloads/mardp-*
# Only check what is missing, and change nothing
$ sh scripts/install.sh -check
# Build the app, copy it into Applications and open it
$ sh scripts/install.sh