Skip to content

Supported Platforms

pkg/install detects the OS and dispatches to the right package manager. This page lists what's supported and how detection works.

Operating systems

OS (OperatingSystem)Detected viaPackage managers
linux (OSLinux)runtime.GOOSapt, yum, dnf, apk, pacman, zypper
darwin (OSDarwin)runtime.GOOSbrew
windows (OSWindows)runtime.GOOSchoco, scoop
unknown (OSUnknown)none (manual override only)

Linux distributions

Detected by parsing /etc/os-release (with file-existence fallbacks for distros that lack it). Constants in pkg/install/installer.go:

Distro (LinuxDistro)ConstPM
UbuntuDistroUbuntuapt
DebianDistroDebianapt
CentOSDistroCentOSyum
RHELDistroRHELyum/dnf
FedoraDistroFedoradnf
RockyDistroRockydnf
AlmaDistroAlmadnf
AlpineDistroAlpineapk
ArchDistroArchpacman
ManjaroDistroManjaropacman
Amazon LinuxDistroAmazonyum/dnf
openSUSEDistroOpenSUSEzypper
unknownDistroUnknownPM guessed by command existence

Architectures

Arch (Architecture)Const
amd64ArchAMD64
arm64ArchARM64
armArchARM
386Arch386
unknownArchUnknown

Detected via runtime.GOARCH.

Package managers

PM (PackageManager)ConstInstall command
aptPMAptapt-get install
yumPMYumyum install
dnfPMDnfdnf install
apkPMApkapk add
pacmanPMPacmanpacman -S
brewPMBrewbrew install
chocoPMChocochoco install
scoopPMScoopscoop install
zypperPMZypperzypper install
unknownPMUnknown

Detection decision tree

Detection order

  1. OSruntime.GOOS (instant, always available).
  2. Archruntime.GOARCH.
  3. Distro (Linux only)detectLinuxDistro():
    • Parse /etc/os-release for ID=.
    • Fall back to distro-specific files (/etc/debian_version, /etc/centos-release, etc.).
    • Last resort: infer from which package-manager command exists.
  4. Package manager — derived from the distro, with a command-existence fallback (detectPackageManagerByCommand).

If detection picks the wrong PM (rare, on unusual distros), override it:

go
opts := install.NewInstallOptions().WithCustomPackageManager(install.PMApt)
installer := install.NewInstaller(opts)

Docker-verified

The integration tests (pkg/install/docker_test.go, run with TEST_DOCKER=1) actually spin up containers and install Ruby on:

  • ubuntu:22.04 (apt) → Ruby 3.x
  • debian:12 (apt) → Ruby 3.x
  • alpine:3.19 (apk) → Ruby 3.x
  • fedora:40 (dnf) → Ruby 3.2.5
  • rockylinux:9 (dnf) → Ruby 3.x

Each test verifies with command -v ruby and ruby -v / gem -v.


Next: Usage.

Released under the MIT License.