This is known to work when initiating the SSH connection for Terminal or iTerm. Using the terminal from VSCode ssh-remote requires extra steps.
Decent reference for troubleshooting. https://twiki.nevis.columbia.edu/twiki/bin/view/Main/X11OnLaptops
- Install XQuartz
- On your mac run this command from the terminal
defaults write org.xquartz.X11 enable_iglx -bool true. Restart XQuartz if it was running, the setting only takes effect on next use. - SSH to the remote server using the
-Xand-Yoptions. The-Yis neccessary to establish trust between the remote server and your X server. - On the remote server verify that the
DISPLAYvariable is set automatically by SSHenv|grep DISPLAY. - On the remote server verify that OpenGL and associate tools/libaries are present
sudo apt-get install glx-utils mesa-utils libgl1-mesa-glx. - Start XQuartz on your Mac if it is not already running. Verify that you can forward an OpenGL application
glxgears.
If you run into issues initiate the SSH connection with verbose logging -v and try again.