← Back to list

How to run local or remote GUI apps in MacOS through SSH X fordwarding

(Including Apple Silicon)

Alfonso Baqueiro Bernal · 2026-05-30 16:25 · 0 claps · 2.2 min read paywalled
#xorg #ssh #xforwarding #macos
Open on Medium ↗

How to run local or remote GUI apps in MacOS through SSH X fordwarding

(Including Apple Silicon)

For the last to work, you first need to run an xorg-server in your Mac.

I use macports as my package manager in MacOS. To install an xorg-server

sudo port install xorg-server

It should be similar if you use the popular homebrew, but I recommend macports over brew, you have more order where the applications are installed in /opt instead of get spread to the whole filesystem. Once installed, a new application X11 in the Mac Launcher will appear (you need to run first before running any x11 based app.

This is also useful if you have a lan or remote linux or UNIX computer and you want to run GUI apps using the display and keyboard mouse input in your mac:

As not expected I get an “Invalid MIT-MAGIC-COOKIE-1 key” error, let me try to fix this to complete this answer.

The “Invalid MIT-MAGIC-COOKIE-1 key” error occurs when an X11 client attempts to connect to a display server but lacks the correct authorization cookie stored in the ~/.Xauthority file. This typically happens when switching users (e.g., using sudo or su), using SSH X11 forwarding, or when the DISPLAY environment variable is misconfigured.

After 2 hours of research it looks like the problem is that the ssh client was unable to get the auth cookie, in the last image, you can read: Warning: No xauth data; using fake authentication data for X11 forwarding.

So the solution was to find the xauth command and add thin info to your .ssh/config with an XAuthLocation directive:

Now I can use ssh to secure forward X11 traffict and doing I/O from my Mac:

Hope this helps you experiment more and get to the idea that ssh is not just CLI interfaces.

I need to do more research to run an window manager and solve issues with more complex GUIs but that will be the topic of another article.


메타데이터
post_id
0a85e4b8cabc
slug
how-to-run-local-or-remote-gui-apps-in-mac-through-ssh-in-xorg-server-0a85e4b8cabc
url
https://medium.com/@abaqueiro/how-to-run-local-or-remote-gui-apps-in-mac-through-ssh-in-xorg-server-0a85e4b8cabc
canonical_url
https://medium.com/@abaqueiro/how-to-run-local-or-remote-gui-apps-in-mac-through-ssh-in-xorg-server-0a85e4b8cabc
author_url
https://medium.com/@abaqueiro
status
ok
fetched_at
2026-06-22 05:41:33