When connecting to a X2Go session using the latest release (4.0.5.1) on Mac OS 10.11, the client displays a dialog box with error message "xmodmap failed to start". Attached is a picture of the error message.

It seems like the search path does not include '/usr/X11/bin' or '/opt/X11/bin' which indeed does have the xmodmap binary.

Some debug -

1) Executing 'echo $PATH' in the terminal displays '/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin'

2) Below is a snippet of 'launchctl procinfo <x2go_pid>' when opening the app from Launchpad.
        inherited environment = {
                DISPLAY => /private/tmp/com.apple.launchd.jbbgc0SnWW/org.macosforge.xquartz:0
                SSH_AUTH_SOCK => /private/tmp/com.apple.launchd.iQM7MSzyBK/Listeners
                Apple_PubSub_Socket_Render => /private/tmp/com.apple.launchd.FBStbBeusm/Render
        }

        default environment = {
                PATH => /usr/bin:/bin:/usr/sbin:/sbin
        }

        environment = {
                USER => zc
                COMMAND_MODE => unix2003
                LOGNAME => zc
                PATH => /usr/bin:/bin:/usr/sbin:/sbin
                DISPLAY => /private/tmp/com.apple.launchd.jbbgc0SnWW/org.macosforge.xquartz:0
                Apple_PubSub_Socket_Render => /private/tmp/com.apple.launchd.FBStbBeusm/Render
                SSH_AUTH_SOCK => /private/tmp/com.apple.launchd.iQM7MSzyBK/Listeners
                SHELL => /bin/bash
                HOME => /Users/zc
                TMPDIR => /var/folders/dr/ylvdtkpd2rv2qkfclsw7y06r0000gn/T/
                __CF_USER_TEXT_ENCODING => 0x1F5:0x0:0x0
                XPC_SERVICE_NAME => com.apple.xpc.launchd.oneshot.0x10000006.x2goclient
        }

3) Executing 'launchctl setenv PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin' in the terminal, followed by opening the app from Launchpad, procinfo shows -
        inherited environment = {
                PATH => /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
                DISPLAY => /private/tmp/com.apple.launchd.jbbgc0SnWW/org.macosforge.xquartz:0
                SSH_AUTH_SOCK => /private/tmp/com.apple.launchd.iQM7MSzyBK/Listeners
                Apple_PubSub_Socket_Render => /private/tmp/com.apple.launchd.FBStbBeusm/Render
        }

        default environment = {
                PATH => /usr/bin:/bin:/usr/sbin:/sbin
        }

        environment = {
                USER => zc
                COMMAND_MODE => unix2003
                LOGNAME => zc
                PATH => /usr/bin:/bin:/usr/sbin:/sbin
                DISPLAY => /private/tmp/com.apple.launchd.jbbgc0SnWW/org.macosforge.xquartz:0
                Apple_PubSub_Socket_Render => /private/tmp/com.apple.launchd.FBStbBeusm/Render
                SSH_AUTH_SOCK => /private/tmp/com.apple.launchd.iQM7MSzyBK/Listeners
                SHELL => /bin/bash
                HOME => /Users/zc
                TMPDIR => /var/folders/dr/ylvdtkpd2rv2qkfclsw7y06r0000gn/T/
                __CF_USER_TEXT_ENCODING => 0x1F5:0x0:0x0
                XPC_SERVICE_NAME => com.apple.xpc.launchd.oneshot.0x10000007.x2goclient
        }

4) Opening the app using terminal by executing 'open -n /Applications/x2goclient.app'
        inherited environment = {
                DISPLAY => /private/tmp/com.apple.launchd.8PPy9QYAsk/org.macosforge.xquartz:0
                SSH_AUTH_SOCK => /private/tmp/com.apple.launchd.WjqkY6s8Nu/Listeners
                Apple_PubSub_Socket_Render => /private/tmp/com.apple.launchd.foKIWVipU9/Render
        }

        default environment = {
                PATH => /usr/bin:/bin:/usr/sbin:/sbin
        }

        environment = {
                PWD => /Users/zc
                USER => zc
                SECURITYSESSIONID => 186a7
                LANG => en_CA.UTF-8
                COMMAND_MODE => unix2003
                TERM => xterm-256color
                PATH => /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
                LOGNAME => zc
                DISPLAY => /private/tmp/com.apple.launchd.8PPy9QYAsk/org.macosforge.xquartz:0
                Apple_PubSub_Socket_Render => /private/tmp/com.apple.launchd.foKIWVipU9/Render
                TERM_PROGRAM_VERSION => 361
                TERM_SESSION_ID => BAFCF5E5-BAA0-4415-AF96-FEBA6619784E
                SSH_AUTH_SOCK => /private/tmp/com.apple.launchd.WjqkY6s8Nu/Listeners
                SHLVL => 1
                SHELL => /bin/bash
                HOME => /Users/zc
                _ => /usr/bin/open
                TERM_PROGRAM => Apple_Terminal
                TMPDIR => /var/folders/dr/ylvdtkpd2rv2qkfclsw7y06r0000gn/T/
                __CF_USER_TEXT_ENCODING => 0x1F5:0x0:0x0
                XPC_SERVICE_NAME => com.apple.xpc.launchd.oneshot.0x10000006.x2goclient
        }

===

Basically, the correct path is set only when the app is opened via the terminal. If the user decides to hit 'OK' to the dialog box, then the x2go session is terminated, but if he decides to leave it unattended, then the user can continue using his session.

I'm not sure what the fix would be here. Do we leave it on the user to fix his default path settings even though 'echo $PATH' shows it is set to the right path? Or, in the code, we hard code the path to
"/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin:/opt/X11/bin", regardless of what the env variable is set to?

Thanks,
Nimesh