Before we can use xhost and xauth across machines, we need to configure the display server to accept incoming network connections. The nolisten_tcp setting controls this. It must be set to false in order to accept connections. This can easily be accomplished through the Mac OS X user defaults system. Use defaults write to change a setting:
defaults write com.apple.x11 nolisten_tcp -boolean false
Remember, false enables incoming connections, true disables connections. Use the boolean values instead of their numeric counterparts.
Alternatively, you can use the X11 Preferences dialog to perform this task, as shown in Figure 3, but you will need to exit and then restart X11 in order for any changes to take effect.
For security reasons, checking “Allow connections” requires that you also check “Authenticate connections”. The authenticate checkbox corresponds to the no_auth flag, which can be set or cleared using defaults write:
defaults write com.apple.x11 no_auth -boolean false