# Install libselinux with Homebrew, apk, apt, dnf, Nix, zypper

SELinux library and simple utilities. Version 3.11 via Homebrew; verified 2026-07-01.

## Install

```sh
sudo av install brew:libselinux
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install libselinux
```

  Evidence: local Homebrew formula metadata

### Linux

- apk (92%):

```sh
sudo apk add libselinux
```

  Evidence: Alpine Linux edge package indexes: libselinux from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install libselinux1
```

  Evidence: Debian stable package indexes: libselinux1 from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install libselinux
```

  Evidence: Fedora Rawhide package metadata: libselinux from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#libselinux
```

  Evidence: nixpkgs package indexes: pkgs/by-name/li/libselinux/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- zypper (92%):

```sh
sudo zypper install libselinux-devel
```

  Evidence: openSUSE Tumbleweed package metadata: libselinux-devel from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst

## Package facts

- **Package key:** brew:libselinux
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/libselinux>
- **Version:** 3.11
- **Source summary:** SELinux library and simple utilities
- **Homepage:** <https://github.com/SELinuxProject/selinux>
- **Repository:** <https://github.com/SELinuxProject/selinux>
- **Upstream docs:** <https://github.com/SELinuxProject/selinux/wiki>
- **License:** LicenseRef-Homebrew-public-domain
- **Source archive:** <https://github.com/SELinuxProject/selinux/releases/download/3.11/libselinux-3.11.tar.gz>
- **Last updated:** 2026-07-01T18:24:07Z
- **Generated:** 2026-07-08T18:08:21+00:00

## Executables

- avcstat (cli)
- compute_av (cli)
- compute_create (cli)
- compute_member (cli)
- compute_relabel (cli)
- getconlist (cli)
- getdefaultcon (cli)
- getenforce (cli)
- getfilecon (cli)
- getpidcon (cli)
- getpidprevcon (cli)
- getpolicyload (cli)
- getsebool (cli)
- getseuser (cli)
- matchpathcon (cli)
- policyvers (cli)
- sefcontext_compile (cli)
- selabel_compare (cli)
- selabel_digest (cli)
- selabel_get_digests_all_partial_matches (cli)
- selabel_lookup (cli)
- selabel_lookup_best_match (cli)
- selabel_partial_match (cli)
- selinux_check_access (cli)
- selinux_check_securetty_context (cli)
- selinuxenabled (cli)
- selinuxexeccon (cli)
- setenforce (cli)
- setfilecon (cli)
- togglesebool (cli)
- validatetrans (cli)
- avcstat (alias)
- compute_av (alias)
- compute_create (alias)
- compute_member (alias)
- compute_relabel (alias)
- getconlist (alias)
- getdefaultcon (alias)
- getenforce (alias)
- getfilecon (alias)
- getpidcon (alias)
- getpidprevcon (alias)
- getpolicyload (alias)
- getsebool (alias)
- getseuser (alias)
- matchpathcon (alias)
- policyvers (alias)
- sefcontext_compile (alias)
- selabel_compare (alias)
- selabel_digest (alias)
- selabel_get_digests_all_partial_matches (alias)
- selabel_lookup (alias)
- selabel_lookup_best_match (alias)
- selabel_partial_match (alias)
- selinux_check_access (alias)
- selinux_check_securetty_context (alias)
- selinuxenabled (alias)
- selinuxexeccon (alias)
- setenforce (alias)
- setfilecon (alias)
- togglesebool (alias)
- validatetrans (alias)

## Dependencies

- libsepol
- pcre2

## Build dependencies

- pkgconf

## Install behavior

- Post-install hook: not defined
- Bottle: available on arm64_linux, x86_64_linux

## Freshness

- Page generated: 2026-07-08
- Package-manager version: 3.11
- Package-manager updated: 2026-07-01
- Local data: ok
- Upstream repository: https://github.com/SELinuxProject/selinux
- info: No cached GitHub release or tag data was available.
## Project history and usage

libselinux is the runtime library and small utility layer used by SELinux-aware programs to talk to SELinux kernel APIs, inspect labels, and perform access-control checks. In package terms it is the userland ABI that turns SELinux from a kernel feature into something daemons, init systems, login tools, package scripts, and administrators can actually use.

### Project history

SELinux began as a National Security Agency research effort around flexible mandatory access control for Linux. NSA documentation from 2001 describes the original SELinux kernel patch for Linux 2.2 and the later Linux Security Module implementation. The modern SELinuxProject userspace repository collects the libraries and tools that complement the kernel feature, including libselinux, libsepol, libsemanage, policycoreutils, and related utilities.

Within that stack, libselinux became the runtime interface for applications that need SELinux context and policy services. The upstream userspace package notes describe libselinux as providing library functions for SELinux kernel APIs such as getcon(), plus support functions such as getseuserbyname(), and note that it may use libsepol when loading policy.

### Adoption history

The upstream SELinux README describes SELinux as present in many major Linux distributions and says the userspace libraries and tools are packaged by Alpine, Debian and Ubuntu, Gentoo, Fedora and RHEL, SLES and openSUSE, Yocto, and others. That made libselinux a quiet but widely depended-on system library rather than an application users install for its own UI.

The userspace packages wiki points to package-manager reverse dependency queries for libselinux as a way to find SELinux-modified programs, and lists init systems, PAM, OpenSSH, cron, sudo, shadow-utils, and other core packages as historical examples of SELinux-aware integration points.

### How it is used

Administrators encounter libselinux through utilities such as getenforce, setenforce, getfilecon, setfilecon, matchpathcon, selinuxenabled, and getsebool. Developers encounter it as the C library used by programs that need to read process and file contexts, ask whether SELinux is enabled, or evaluate an SELinux permission decision.

On macOS via Homebrew it is mainly useful for policy analysis and tooling experiments, not for enabling the Linux kernel SELinux enforcement path.

### Why package nerds care

libselinux is one of those packages whose importance is mostly visible through dependency graphs: if SELinux support is compiled into system software, this library is often the shared object that appears in the linkage. It is also a good example of how Linux security features split across kernel APIs, policy compilers, runtime libraries, and distro packaging.

For Homebrew users, libselinux is interesting because it brings a Linux security userland component onto macOS mostly as a build dependency and analysis library, exposing the portability boundary between SELinux policy tooling and actual SELinux enforcement.

### Timeline

- 2001: NSA published SELinux technical reports covering the Linux 2.2 kernel patch and the Linux Security Module based implementation.
- 2008-09-09: The SELinux userspace release archive lists source tarball releases for libselinux, libsepol, policycoreutils, and related packages.
- 2015-02-02: The userspace release notes moved the default SELinux module store to /var/lib/selinux/.
- 2026-02-02: The SELinuxProject repository release list records SELinux userspace release 3.10.

### Related projects

- libsepol manipulates SELinux binary policy, libsemanage manages installed policy modules, policycoreutils provides administrative commands, checkpolicy and secilc compile policy, and the Linux kernel enforces the loaded policy.

### Sources

- <https://github.com/SELinuxProject/selinux>
- <https://github.com/SELinuxProject/selinux/wiki>
- <https://github.com/SELinuxProject/selinux/wiki/Releases>
- <https://github.com/SELinuxProject/selinux/wiki/Userspace-Packages>
- <https://www.nsa.gov/Research/Technical-Papers-Brochures/smdpage14229/2/smdsort14229/description/>


## Security Notes

library-like package without higher-risk signals.

- **Geiger risk:** green / low
- library-like package without higher-risk signals

## Source Database Details

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** libselinux
- **Version Scheme:** 0
- **Revision:** 0
- **Requirements:** linux
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** stable

## Other Package-Manager Records

- Debian apt - libselinux1 - 3.8.1-1: normalized package name match | Debian stable package indexes: libselinux1 from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | SELinux runtime shared libraries | https://github.com/SELinuxProject
- Debian apt - libselinux1-dev - 3.8.1-1: normalized package name match | Debian stable package indexes: libselinux1-dev from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | SELinux development headers | https://github.com/SELinuxProject
- Debian apt - python3-selinux - 3.8.1-1: normalized package name match | Debian stable package indexes: python3-selinux from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Python3 bindings to SELinux shared libraries | https://github.com/SELinuxProject
- Debian apt - ruby-selinux - 3.8.1-1: normalized package name match | Debian stable package indexes: ruby-selinux from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Ruby bindings to SELinux shared libraries | https://github.com/SELinuxProject
- Debian apt - selinux-utils - 3.8.1-1: normalized package name match | Debian stable package indexes: selinux-utils from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | SELinux utility programs | https://github.com/SELinuxProject
- Nix - libselinux: normalized package name match | nixpkgs package indexes: pkgs/by-name/li/libselinux/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - libselinux1 - 3.5-2ubuntu2: normalized package name match | Ubuntu 24.04 LTS package indexes: libselinux1 from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | SELinux runtime shared libraries | https://selinuxproject.org
- Ubuntu apt - libselinux1-dev - 3.5-2ubuntu2: normalized package name match | Ubuntu 24.04 LTS package indexes: libselinux1-dev from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | SELinux development headers | https://selinuxproject.org
- Ubuntu apt - python3-selinux - 3.5-2ubuntu2: normalized package name match | Ubuntu 24.04 LTS package indexes: python3-selinux from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | Python3 bindings to SELinux shared libraries | https://selinuxproject.org
- Ubuntu apt - ruby-selinux - 3.5-2ubuntu2: normalized package name match | Ubuntu 24.04 LTS package indexes: ruby-selinux from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | Ruby bindings to SELinux shared libraries | https://selinuxproject.org
- Ubuntu apt - selinux-utils - 3.5-2ubuntu2: normalized package name match | Ubuntu 24.04 LTS package indexes: selinux-utils from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | SELinux utility programs | https://selinuxproject.org
- apk - libselinux - 3.10-r1: normalized package name match | Alpine Linux edge package indexes: libselinux from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | SELinux library and simple utilities | https://github.com/SELinuxProject/selinux/wiki
- apk - libselinux-dev - 3.10-r1: normalized package name match | Alpine Linux edge package indexes: libselinux-dev from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | SELinux library and simple utilities (development files) | https://github.com/SELinuxProject/selinux/wiki
- apk - libselinux-doc - 3.10-r1: normalized package name match | Alpine Linux edge package indexes: libselinux-doc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | SELinux library and simple utilities (documentation) | https://github.com/SELinuxProject/selinux/wiki
- apk - libselinux-static - 3.10-r1: normalized package name match | Alpine Linux edge package indexes: libselinux-static from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | SELinux library and simple utilities (static library) | https://github.com/SELinuxProject/selinux/wiki
- apk - libselinux-utils - 3.10-r1: normalized package name match | Alpine Linux edge package indexes: libselinux-utils from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | SELinux libselinux utilies | https://github.com/SELinuxProject/selinux/wiki


## Related links

- [Source-control packages](https://www.automicvault.com/pkg/source-control-tools/) - Belongs to a source-control command family.
- [Terminal utility packages](https://www.automicvault.com/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Networking and protocol packages](https://www.automicvault.com/pkg/networking-protocol-tools/) - Matched network, protocol, or remote-service metadata.
- [Security and crypto packages](https://www.automicvault.com/pkg/security-crypto-tools/) - Matched security, identity, cryptography, password, signing, or certificate metadata.
- [libsepol](https://www.automicvault.com/pkg/brew/libsepol/) - Runtime dependency declared by Homebrew.
- [pcre2](https://www.automicvault.com/pkg/brew/pcre2/) - Runtime dependency declared by Homebrew.
- [pkgconf](https://www.automicvault.com/pkg/brew/pkgconf/) - Build dependency declared by Homebrew.
- [fwknop](https://www.automicvault.com/pkg/brew/fwknop/) - Shares av.db curated category or tags: access-control, cli, security.
- [knock](https://www.automicvault.com/pkg/brew/knock/) - Shares av.db curated category or tags: access-control, cli, security.
- [rush](https://www.automicvault.com/pkg/brew/rush/) - Shares av.db curated category or tags: access-control, cli, security.
- [openfga](https://www.automicvault.com/pkg/brew/openfga/) - Shares av.db curated category or tags: access-control, cli, security.
- [pomerium](https://www.automicvault.com/pkg/brew/pomerium/) - Shares av.db curated category or tags: access-control, cli, security.
- [spicedb](https://www.automicvault.com/pkg/brew/spicedb/) - Shares av.db curated category or tags: access-control, cli, security.
- [teleport](https://www.automicvault.com/pkg/brew/teleport/) - Shares av.db curated category or tags: access-control, cli, security.
- [hydra](https://www.automicvault.com/pkg/brew/hydra/) - Security-sensitive metadata or terminology overlaps. Shared terms: cli, pcre2, security.

## Combined YAML source

View the package source record on GitHub. [combined/libselinux.yml](https://github.com/automic-vault/db/blob/main/combined/libselinux.yml)


## Sources

- Nucleus package database
- Geiger risk classifier
- package-page enrichment
- curated package history
- package version freshness
- av.db category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
