diff --git a/runner-docs/installation/binary.md b/runner-docs/installation/binary.md index e47d02d0..30990a9f 100644 --- a/runner-docs/installation/binary.md +++ b/runner-docs/installation/binary.md @@ -84,7 +84,16 @@ For jobs in containers, give the `gitea-runner` user access to the Docker daemon ## launchd (macOS) -Adjust the paths and user for your setup, then save this file as `/Library/LaunchDaemons/com.gitea.runner.plist`: +On macOS, run the runner in the login session of the user that jobs should run as. Jobs then have that user's login keychain and the GUI. + +Register the runner as that user, with a [host label](../labels.md) so that jobs run on the Mac itself: + +```bash +mkdir ~/gitea-runner && cd ~/gitea-runner +gitea-runner register --instance https://gitea.example.com --token --labels macos-latest:host +``` + +Replace `/Users/gitea-runner` with the user's home directory, then save this file as `~/Library/LaunchAgents/com.gitea.runner.plist`: ```xml @@ -97,22 +106,16 @@ Adjust the paths and user for your setup, then save this file as `/Library/Launc /usr/local/bin/gitea-runner daemon - --config - /etc/gitea-runner/config.yaml - UserName - _gitea-runner WorkingDirectory - /var/lib/gitea-runner + /Users/gitea-runner/gitea-runner EnvironmentVariables PATH - /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin - HOME - /var/lib/gitea-runner + /opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin StandardErrorPath - /var/lib/gitea-runner/runner.log + /Users/gitea-runner/gitea-runner/runner.log RunAtLoad KeepAlive @@ -121,10 +124,30 @@ Adjust the paths and user for your setup, then save this file as `/Library/Launc ``` +Start the runner. From now on, it also starts whenever the user logs in: + ```bash -sudo launchctl bootstrap system /Library/LaunchDaemons/com.gitea.runner.plist +launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.gitea.runner.plist ``` +Enable automatic login for the user in System Settings, so that the runner starts after a restart too. macOS does not offer automatic login while FileVault is on. + +The runner does not get the environment of your shell. Set what jobs need, such as [proxy settings](../proxy.md), in `EnvironmentVariables`. + +### Local network access + +macOS blocks a runner that was started this way from other hosts on the Mac's own subnet, such as the Gitea instance or a shared cache server. The runner then logs `no route to host`. Commands run in Terminal or over SSH are not blocked, so registering works even when the running runner cannot connect. See [local network privacy](https://developer.apple.com/documentation/technotes/tn3179-understanding-local-network-privacy). + +macOS asks on the Mac's screen whether to allow the access. To allow it without that prompt, exempt the subnet on macOS 15.5 or later and restart the Mac. On Wi-Fi, the key is `AllowedWiFiLocalNetworkAddresses`: + +```bash +sudo defaults write com.apple.network.local-network AllowedEthernetLocalNetworkAddresses -array "192.168.1.0/24" +``` + +### Git credentials + +Git on macOS saves credentials from remote URLs to the keychain, which can stop a job at a dialog that nobody answers. To turn that off, set `GIT_CONFIG_NOSYSTEM` to `1` in `EnvironmentVariables`. + ## Windows Run `gitea-runner daemon` with a service wrapper such as [WinSW](https://github.com/winsw/winsw). The runner has no service installer of its own. diff --git a/runner-docs_versioned_docs/version-5/installation/binary.md b/runner-docs_versioned_docs/version-5/installation/binary.md index cb768999..888d84c5 100644 --- a/runner-docs_versioned_docs/version-5/installation/binary.md +++ b/runner-docs_versioned_docs/version-5/installation/binary.md @@ -84,7 +84,16 @@ For jobs in containers, give the `gitea-runner` user access to the Docker daemon ## launchd (macOS) -Adjust the paths and user for your setup, then save this file as `/Library/LaunchDaemons/com.gitea.runner.plist`: +On macOS, run the runner in the login session of the user that jobs should run as. Jobs then have that user's login keychain and the GUI. + +Register the runner as that user, with a [host label](../labels.md) so that jobs run on the Mac itself: + +```bash +mkdir ~/gitea-runner && cd ~/gitea-runner +gitea-runner register --instance https://gitea.example.com --token --labels macos-latest:host +``` + +Replace `/Users/gitea-runner` with the user's home directory, then save this file as `~/Library/LaunchAgents/com.gitea.runner.plist`: ```xml @@ -97,22 +106,16 @@ Adjust the paths and user for your setup, then save this file as `/Library/Launc /usr/local/bin/gitea-runner daemon - --config - /etc/gitea-runner/config.yaml - UserName - _gitea-runner WorkingDirectory - /var/lib/gitea-runner + /Users/gitea-runner/gitea-runner EnvironmentVariables PATH - /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin - HOME - /var/lib/gitea-runner + /opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin StandardErrorPath - /var/lib/gitea-runner/runner.log + /Users/gitea-runner/gitea-runner/runner.log RunAtLoad KeepAlive @@ -121,10 +124,30 @@ Adjust the paths and user for your setup, then save this file as `/Library/Launc ``` +Start the runner. From now on, it also starts whenever the user logs in: + ```bash -sudo launchctl bootstrap system /Library/LaunchDaemons/com.gitea.runner.plist +launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.gitea.runner.plist ``` +Enable automatic login for the user in System Settings, so that the runner starts after a restart too. macOS does not offer automatic login while FileVault is on. + +The runner does not get the environment of your shell. Set what jobs need, such as [proxy settings](../proxy.md), in `EnvironmentVariables`. + +### Local network access + +macOS blocks a runner that was started this way from other hosts on the Mac's own subnet, such as the Gitea instance or a shared cache server. The runner then logs `no route to host`. Commands run in Terminal or over SSH are not blocked, so registering works even when the running runner cannot connect. See [local network privacy](https://developer.apple.com/documentation/technotes/tn3179-understanding-local-network-privacy). + +macOS asks on the Mac's screen whether to allow the access. To allow it without that prompt, exempt the subnet on macOS 15.5 or later and restart the Mac. On Wi-Fi, the key is `AllowedWiFiLocalNetworkAddresses`: + +```bash +sudo defaults write com.apple.network.local-network AllowedEthernetLocalNetworkAddresses -array "192.168.1.0/24" +``` + +### Git credentials + +Git on macOS saves credentials from remote URLs to the keychain, which can stop a job at a dialog that nobody answers. To turn that off, set `GIT_CONFIG_NOSYSTEM` to `1` in `EnvironmentVariables`. + ## Windows Run `gitea-runner daemon` with a service wrapper such as [WinSW](https://github.com/winsw/winsw). The runner has no service installer of its own.