Setup XQuartz X11 server on MacΒΆ
The XQuartz X11 server will be used to allow us visualise GUI programs, which are running inside the Docker container, on the host Mac machine. The following guide has been adapted from this link.
Install XQuartz
From the XQuartz website
Using homebrew
brew cask install xquartz
Run XQuartz
Start XQuartz from command line using:
open -a XQuartz
In the XQuartz preferences, go to the
Securitytab and make sureAllow connections from network clientsis ticked.Exit and restart XQuartz to allow the updated preferences to take affect.
Identify and add your Host Machine IP to Xhost
Run the following command in a terminal to find your Host Machine IP:
IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
Check if the
IPenviromental variable has been set correctly:echo $IP
If blank and you are on wifi, try
en1instead ofen0in Step (i).Add the IP using Xhost:
xhost + $IPIf this produces an error, try:
/usr/X11/bin/xhost + $IP