Skip to main content

XQuartz: Enable ‘Allow connections from network clients’ via command line [Resolved]

I'd like to write a shell script that uses xquartz.

Specifically the ‘Allow connections from network clients’ checkbox at Settings/Security has to be checked. Is there a way to do this programmatically ?


Question Credit: p4rch
Question Reference
Asked June 10, 2019
Posted Under: Apple
13 views
1 Answers

Xquartz settings are stored in ~/Library/Preferences/org.macosforge.xquartz.X11.plist, the key you are looking for is nolisten_tcp.

To allow connections from network clients use

defaults write org.macosforge.xquartz.X11.plist nolisten_tcp 0

To prevent connections use

defaults write org.macosforge.xquartz.X11.plist nolisten_tcp 1

For both cases Xquartz must not be running while you apply the change.

PS: To look at the content of the file you can use

plutil -p ~/Library/Preferences/org.macosforge.xquartz.X11.plist 

credit: nohillside
Answered June 10, 2019
Your Answer
D:\Adnan\Candoerz\CandoProject\vQA