preventing ssh command from opening xquartz on every session

Whenever I use ssh, after I type the password, xQuartz pop ups in the dock and terminal window looses focus. This happens even if there's no an X session. Why? How to prevent this behavior?


Solution 1:

Solved by myself. XQuartz installation added a custom configuration for ssh in /etc/ssh/ssh_config (or /etc/ssh_config for older macOS versions). I have just removed ForwardX11 yes and ssh won't open XQuartz anymore.

Below shows the file contents that's causing XQuartz to open.

$ tail -5 /etc/ssh/ssh_config
    SendEnv LANG LC_*

# XAuthLocation added by XQuartz (https://www.xquartz.org)
Host *
    XAuthLocation /opt/X11/bin/xauth