DEV Community

Lilika Makabe
Lilika Makabe

Posted on

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.

Top comments (3)

Collapse
 
john777r profile image
John777R

Using multiple monitors for work and different projects is quite convenient

Collapse
 
tomford profile image
tomford51 • Edited

I agree with you. I also usually do this when the project is quite complex and I need to do several tasks at the same time. To be honest, I couldn't figure out how to use multiple monitors at the same time, so I found the answer on setapp rather detailed instructions here

Collapse
 
tomford profile image
tomford51

ok i bought a poppy and will try to figure it out