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?

  • Just to clarify - forwarding the X ports over requires using the -X switch within ssh. You want to use the switch in order to use xQuartz within the ssh session, yet retain the focus on the terminal window until you actually do so?
    – Scot
    May 17 '13 at 19:54
  • I just want a normal command line access, not x window session. I didn't use -X. For example: ssh user@server.local
    – Rnhmjoj
    May 17 '13 at 20:06
  • Odd. Is there any alias or anything that may be mapped to your ssh command?
    – Scot
    May 17 '13 at 20:08
  • I don't think. There is nothing that I added to ssh in .profile or .bashrc.
    – Rnhmjoj
    May 17 '13 at 20:11
  • Do you have anything in your ~/.ssh/config file that may trigger the use of X11? eg, the ForwardX11 option would do it.
    – mjturner
    May 17 '13 at 21:07

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .