MacOS: LaunchAgent - Service could not initialize on M1 architecture
## Summary Executing gitlab-runner via LaunchAgent works fine on my Intel machines but fails on my M1 machines: ``` … Service could not initialize: 20G95: xpcproxy + 18576 [271][A56B106B-D3BE-32F1-A95E-048C6795575A]: 0xd … Service exited with abnormal code: 78 ``` ## Steps to reproduce <details> <summary>Install gitlab-runner</summary> ```sh sudo curl --output /usr/local/bin/gitlab-runner "https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-darwin-amd64" sudo chmod +x /usr/local/bin/gitlab-runner su - "$(whoami)" gitlab-runner --debug install --working-directory "$HOME/gitlab-runner" --syslog gitlab-runner --debug start ``` </details> ## Actual behavior ``` ➜ gitlab-runner status Runtime platform arch=amd64 os=darwin pid=7340 revision=8925d9a0 version=14.1.0 gitlab-runner: Service has stopped ``` ## Expected behavior ``` ➜ gitlab-runner status Runtime platform arch=amd64 os=darwin pid=1642 revision=8925d9a0 version=14.1.0 gitlab-runner: Service is running ``` ## Relevant logs and/or screenshots <details> <summary>syslog</summary> ``` Aug 12 19:45:00 MyMachine com.apple.xpc.launchd[1] (gitlab-runner[7363]): Service could not initialize: 20G95: xpcproxy + 18576 [271][A56B106B-D3BE-32F1-A95E-048C6795575A]: 0xd Aug 12 19:45:00 MyMachine com.apple.xpc.launchd[1] (gitlab-runner[7363]): Service exited with abnormal code: 78 Aug 12 19:45:00 MyMachine com.apple.xpc.launchd[1] (gitlab-runner): Service only ran for 0 seconds. Pushing respawn out by 10 seconds. ``` </details> <details> <summary>~/Library/LaunchAgents/gitlab-runner.plist</summary> ``` <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd" > <plist version='1.0'> <dict> <key>Label</key> <string>gitlab-runner</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/gitlab-runner</string> <string>run</string> <string>--working-directory</string> <string>/Users/MyUser/gitlab-runner</string> <string>--config</string> <string>/Users/MyUser/.gitlab-runner/config.toml</string> <string>--service</string> <string>gitlab-runner</string> <string>--syslog</string> </array> <key>SessionCreate</key> <false/> <key>KeepAlive</key> <true/> <key>RunAtLoad</key> <true/> <key>Disabled</key> <false/> <key>StandardOutPath</key> <string>/usr/local/var/log/gitlab-runner.out.log</string> <key>StandardErrorPath</key> <string>/usr/local/var/log/gitlab-runner.err.log</string> </dict> </plist> ``` </details> <details> <summary>launchctl dumpstate</summary> ``` gitlab-runner = { active count = 0 copy count = 0 one shot = 0 path = /Users/MyUser/Library/LaunchAgents/gitlab-runner.plist state = pending program = /usr/local/bin/gitlab-runner arguments = { /usr/local/bin/gitlab-runner run --working-directory /Users/MyUser/gitlab-runner --config /Users/MyUser/.gitlab-runner/config.toml --service gitlab-runner --syslog } stdout path = /usr/local/var/log/gitlab-runner.out.log stderr path = /usr/local/var/log/gitlab-runner.err.log inherited environment = { SSH_AUTH_SOCK => /private/tmp/com.apple.launchd.oa3pOc9zrp/Listeners } default environment = { PATH => /usr/bin:/bin:/usr/sbin:/sbin } environment = { XPC_SERVICE_NAME => gitlab-runner } domain = com.apple.xpc.launchd.user.domain.501.100005.Aqua asid = 100005 minimum runtime = 10 exit timeout = 5 runs = 1 successive crashes = 0 last exit code = 78: EX_CONFIG event triggers = { } endpoints = { } dynamic endpoints = { } pid-local endpoints = { } instance-specific endpoints = { } event channels = { } sockets = { } instances = { } spawn type = daemon (3) jetsam priority = 3 jetsam memory limit (active) = (unlimited) jetsam memory limit (inactive) = (unlimited) jetsamproperties category = daemon submitted job. ignore execute allowed jetsam thread limit = 32 cpumon = default properties = { partial import = 0 xpc bundle = 0 keepalive = 1 runatload = 1 low priority i/o = 0 low priority background i/o = 0 dataless file mode = 0 legacy timer behavior = 0 exception handler = 0 supports transactions = 0 supports pressured exit = 0 supports idle hysteresis = 0 enter kdp before kill = 0 wait for debugger = 0 app = 0 system app = 0 creates session = 0 inetd-compatible = 0 inetd listener = 0 abandon process group = 0 event monitor = 0 penalty box = 0 role account = 0 launch only once = 0 system support = 0 inferred program = 1 joins gui session = 0 joins host session = 0 parameterized sandbox = 0 resolve program = 0 abandon coalition = 0 high bits aslr = 0 reslide shared cache = 0 disable resliding = 0 extension = 0 nano allocator = 0 no initgroups = 0 start on fs mount = 0 needs implicit endpoint = 0 is copy = 0 disallow all lookups = 0 system service = 0 protected by submitter = 0 multiple instances = 0 } } ``` </details> <details> <summary><code>gitlab-runner run</code></summary> ``` ➜ gitlab-runner --debug run --working-directory "$HOME/gitlab-runner" Runtime platform arch=amd64 os=darwin pid=56260 revision=8925d9a0 version=14.1.0 Starting multi-runner from /Users/MyUser/.gitlab-runner/config.toml... builds=0 Checking runtime mode GOOS=darwin uid=501 WARNING: Running in user-mode. WARNING: Use sudo for system-mode: WARNING: $ sudo gitlab-runner... Configuration loaded builds=0 listenaddress: :9101 sessionserver: listenaddress: "" advertiseaddress: "" sessiontimeout: 1800 concurrent: 1 checkinterval: 0 loglevel: null logformat: null user: "" runners: - name: MyMachine limit: 1 outputlimit: 10240 requestconcurrency: 1 runnercredentials: url: https://my.host/gitlab/ token: <redacted> tlscafile: "" tlscertfile: /Users/MyUser/.certs/user.crt tlskeyfile: /Users/MyUser/.certs/user.key runnersettings: executor: shell buildsdir: "" cachedir: "" cloneurl: "" environment: - <redacted> preclonescript: "" prebuildscript: "" postbuildscript: "" debugtracedisabled: false shell: "" custombuilddir: enabled: false referees: null cache: type: "" path: "" shared: false s3: serveraddress: "" accesskey: "" secretkey: "" bucketname: "" bucketlocation: "" insecure: false gcs: cachegcscredentials: accessid: "" privatekey: "" credentialsfile: "" bucketname: "" azure: cacheazurecredentials: accountname: "" accountkey: "" containername: "" storagedomain: "" gracefulkilltimeout: null forcekilltimeout: null featureflags: {} ssh: null docker: null parallels: null virtualbox: null machine: null kubernetes: null custom: null sentrydsn: null modtime: 2021-05-16T16:49:24.03263497+02:00 loaded: true builds=0 Waiting for stop signal builds=0 Metrics server listening address=:9101 builds=0 [session_server].listen_address not defined, session endpoints disabled builds=0 Feeding runners to channel builds=0 Starting worker builds=0 worker=0 Trying to load /Users/MyUser/.certs/user.crt and /Users/MyUser/.certs/user.key pair... Dialing: tcp my.host:443 ... Checking for jobs... nothing runner=<redacted> Feeding runners to channel builds=0 Checking for jobs... nothing runner=<redacted> Feeding runners to channel builds=0 ``` </details> ## Environment description * macOS `11.3.1 (20E241)` and `11.5.2 (20G95)` * working fine on Intel architecture (tested on 3 machines) * failing on M1 architecture (tested on 4 machines) ### Used GitLab Runner version ``` ➜ gitlab-runner --version Version: 14.1.0 Git revision: 8925d9a0 Git branch: 14-1-stable GO version: go1.13.8 Built: 2021-07-20T11:43:24+0000 OS/Arch: darwin/amd64 ``` ## Possible fixes [Homebrew installation (alternative)](https://docs.gitlab.com/runner/install/osx.html#homebrew-installation-alternative)
issue