DEV Community

Lilika Makabe
Lilika Makabe

Posted on

1

Mac's Screen Sharing with Multiple Monitors πŸ–₯πŸ–₯ ▢️πŸ–₯πŸ–₯

Intro

Although MacOS offers an official remote desktop App, "Screen Sharing," it doesn't support a 'multiple monitors to multiple monitors' remote access.
Opening 2 sessions, one corresponding to 1st monitor, the other to 2nd would be an alternative, but actually Screen Sharing App doesn't support opening multiple sessions from within the app for the same PC, same user.

So people has struggled to prepare multiple users
[App Community : "How to screen share with multiple monitors on both computers"], but it's hastle, at least for me.

I finally managed to do it, without the bothering work like switching the user, and summarize how to do that in the following! Glad if someone finds it helpful:)

Answer

The answer was a quite simple, if you call the executable of the App, then you can open 2 sessions, for the same destination.

Search App's executable

In MacOS (I'm using Monterey), any App's executable is often located at ${APP_DIRECTORY}/Contents/MacOS/${APPNAME}.
In my system, Screen Sharing is in /System/Library/CoreServices/Applications/Screen\ Sharing.app, so calling the following command in Terminal results in 2 sessions of remote desktop.

# open for 1st monitor
/System/Library/CoreServices/Applications/Screen\ Sharing.app/Contents/MacOS/Screen\ Sharing
# call the same exe. for 2nd monitor
/System/Library/CoreServices/Applications/Screen\ Sharing.app/Contents/MacOS/Screen\ Sharing
Enter fullscreen mode Exit fullscreen mode

For easy calling

Although just calling the above command solves the problem, it is still troublesome to memorize the path or hit this long path, so I prefer to set the alias for the command.
All you need to do is to open the ~/.bashrc, add the following line somewhere in that file, and save it.

# User specific aliases and functions
alias remote_desktop="/System/Library/CoreServices/Applications/Screen\ Sharing.app/Contents/MacOS/Screen\ Sharing"
## ... other settings...
Enter fullscreen mode Exit fullscreen mode

then run

source ~/.bashrc
Enter fullscreen mode Exit fullscreen mode

to reflect the change in ~/.bashrc.
Since ~/.bashrc is read and reflected when bash starts, the above is needed to force bash to read the configuration
in ~/.bashrc again.

Then after that, everytime you hit

remote_desktop
Enter fullscreen mode Exit fullscreen mode

in Terminal, the new Screen Sharing window will open up.
I'm connecting from 2 monitors (local) to 2 monitors (remote) without any problem.

Summary

Calling the executable itself enables us to open the multiple sessions almost for any App, for example like Blender.
If suddenly the above solution stopped operating after a major update, then I suspect the directory structure has changed.
You may want check if the path really exists, and search the new executable path.
Anyway, hope multiple monitors to multiple monitor remote desktop will be officially supported in the future.

Sentry image

See why 4M developers consider Sentry, β€œnot bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (1)

Collapse
 
john777r profile image
John777R β€’

Using multiple monitors for work and different projects is quite convenient

Some comments may only be visible to logged-in visitors. Sign in to view all comments.

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay