Supported Distributions
cosh-ng automatically detects the current operating system by reading /etc/os-release (Linux) or calling sw_vers (macOS), and routes to the corresponding package manager and service manager backend.
Support Matrix
| Distribution | Package Manager | Service Manager | Notes |
|---|---|---|---|
| Alinux (2/3/4) | dnf | systemd | Alibaba Cloud native Linux |
| CentOS 7/8/9 | dnf | systemd | |
| Fedora | dnf | systemd | |
| Ubuntu | apt-get | systemd | |
| Debian | apt-get | systemd | |
| openSUSE Leap/Tumbleweed | zypper | systemd | |
| macOS | brew | — | Only pkg subsystem available |
Detection Logic
Distribution detection is implemented via Distro::detect():
- When the compile target is macOS, calls
sw_vers -productVersionto get the version - On Linux, reads
/etc/os-releaseand parses theIDandVERSION_IDfields - Maps
IDto a known distribution variant - Unrecognized
IDvalues fall intoUnknown, and most operations returnUnsupportedDistroerror
Package Manager Mapping
| Distribution ID | Package Manager | Install Command | Search Command |
|---|---|---|---|
| alinux / centos / fedora | Dnf | dnf install -y | dnf search -q |
| ubuntu / debian | Apt | apt-get install -y | apt-cache search |
| opensuse-leap / opensuse-tumbleweed / sles | Zypper | zypper install -y | zypper search |
| macOS | Brew | brew install | brew search |
Service Manager
All Linux distributions use systemd (systemctl) uniformly. macOS does not support the svc subsystem.
Adding New Distribution Support
To add support for a new distribution, see the developer documentation Adding Distribution Support Guide.