After double clicking X11 it quits after a while. The console's log file tells me teh following:
X11.app: main(): argc=1
argv = /Applications/Utilities/XQuartz.app/Contents/MacOS/X11.bin
Waiting for startup parameters via Mach IPC.
X11.app: No launchd socket handed off, unsetting DISPLAY
X11.app: do_start_x11_server(): argc=5
argv = /opt/X11/bin/Xquartz
argv = :0
argv = -listen
argv = tcp
argv = -iglx
[1748581.963] Xquartz starting:
[1748581.963] X.Org X Server 1.18.4
[1748581.963] Build Date: 20161025
[1748581.968] x: 0, y: 0, w: 1920, h: 1200
[1748581.987] (II) GLX: Initialized Core OpenGL GL provider for screen 0
[1748582.139] X11.app: DarwinProcessFDAdditionQueue_thread: Sleeping to allow xinitrc to catchup.
[1748582.171] (EE) Error loading keymap /tmp/server-0.xkm
[1748582.171] (EE) XKB: Failed to load keymap. Loading default keymap instead.
[1748584.803] (II) Server terminated successfully (0). Closing log file.
How can I repair it?
That should be non-fatal. We expect to not load a keymap.
It looks like everything is behaving correctly from the perspective of the log you provided.
If you're seeing XQuartz quit soon after launch, the issue could be that you have a ~/.xinitrc file getting in the way of things.
How can I resolve the ~/.xinitrc issue or check if it is the problem?
Just delete it if it exists. You can ask for help on the xorg or x11-users mailing lists.