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.