Continuing discussion in #lima slack: https://cloud-native.slack.com/archives/C043N6ZFV9S/p1731620681024829 We want to create easy to use installer that works for everyone and is secure by default. The current way to install is downloading the tarball and extracting it to the safe directory (writable only by root). This is easy to get wrong by using /usr/local or installing in your home directory as unprivileged user. It is also easy to install in a safe non-default location that requires additional configuration in related application like lima. The next step is adding a launchd service, which is much harder on macOS compared to Linux. There are legacy and new ways to add an start a service, that seem to work or do nothing. This user experience is very poor. To use bridged network, you need to modify the the launchd configuration to include the interface name. ## Installer package Provide a standard installer package (e.g. `socket_vmnet-x.y.z-aarch64.pkg`) in the github release page. The package can be installed using the `Installer.app` application (e.g. `open socket_vmnet-x.y.z-aarch64.pkg`) or using automated installation using the `installer` command. The installer will install socket_vmnet to the default location /opt/socket_vmmnet, enforcing the correct permissions on the install directory (the recommended default). The installer package can be created using pkgbuild: ``` pkgbuild --root ./_artifacts/{arch} --identifier io.github.lima-vm.socket_vmnet socket_vmnet-{version}-{arch}.pkg ``` The only documentation seems to be `pkgbuild(1)`. ## Adding and removing launchd service The socket_vment executable will provide sub command to install and remove the launchd service: ```console socket_vmnet --install-service [--bridged=INTERFACE] [--service-plist=FILE] ``` The install command will install the plist file, replacing the INTERFACE name for bridged mode, and start or restart the service. To use non default options user can copy the default plist files and use --service-plist=my-service.plist. ```console socket_vmnet --remove-service [--bridged=INTERFACE] ``` The remove command will stop and remove the service installed by the install command. ## Documentation When we have a downloadable pkg file, we can replace the binary installation instructions with instructions for the pkg file. - Using the `Installer.app` - open the pkg file an follow the installer pages - Using the `installer` command - show the commands to install the pkg ## Testing We can build the pkg and install it using the `installer` command in the tests. We need to test: - new install - upgrading from previous version - install latest release pkg, and upgrading to the pkg build from current master - install and start the launchd service - stop and remove the launchd service - should be tested on all supported macos version Install tests are very quick and does not require much resources, can run on all standard macos runners ## See also - https://developer.apple.com/documentation/xcode/packaging-mac-software-for-distribution