Simo Virokannas

Writings and ramblings

Gitlab-runner, MacOS 12

If you’ve tried setting up a gitlab-runner on MacOS 12 you may have run into the same problem I did – even when you follow all the manual setup steps, it just won’t start (unless you run it in interactive mode).

Note that this probably doesn’t apply to running it using homebrew. It might work out of the box with it, but then again, your system is completely messed up already.

The reason it wouldn’t start is fairly simple. The launchctl config file dropped under your Library/LaunchAgents sets up the log files to go under /usr/local/var/log – this is a path that does not exist on MacOS 12.

Solution 1: Create the folder /usr/local/var/log and grant write access to your user account running the gitlab-runner:

sudo mkdir /usr/local/var/log
sudo chown [username] /usr/local/var/log

Best case scenario just running those two commands will make it immediately launch and start accepting jobs (like it did for me).

Solution 2: Change the launchctl file to write the log files to a path your gitlab user has access to.
You simply open the file ~/Library/LaunchAgents/gitlab-runner.plist and modify the two paths towards the end:

<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>

Then, restart the launch agent:

launchctl unload ~/Library/LaunchAgents/gitlab-runner.plist
launchctl load -w ~/Library/LaunchAgents/gitlab-runner.plist


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.