# How to Generate an SBOM: Tools and Guides (2026)

> Complete SBOM generation guide: how to generate an SBOM from a lockfile, container image or build system, which SBOM generation tools to use for each ecosystem, and how to automate it in CI/CD. Covers Syft, cdxgen, native ecosystem tools and sbomify-action, in CycloneDX and SPDX.

**TL;DR:** Generate an SBOM from your lockfile, not your installed environment – the lockfile is what pins exact versions and hashes. Pick a tool that understands your ecosystem: Syft and cdxgen cover the widest range, native generators like cyclonedx-py handle a single language, and sbomify-action selects the right one for you and enriches the result. Run it in CI on every build so the SBOM matches the artefact you shipped. Output CycloneDX or SPDX – both are accepted by every major compliance framework.

Step-by-step guides for generating SBOMs across every major programming language and platform. New to SBOMs? Start with [What is an SBOM?](https://sbomify.com/what-is-sbom/) for the basics, or jump straight to your ecosystem below.

Generating a Software Bill of Materials is the first step in the [SBOM lifecycle](https://sbomify.com/features/generate-collaborate-analyze/). It is also the step that determines the quality of everything downstream: a vulnerability scan, a compliance attestation, and a customer-facing [Trust Center](https://sbomify.com/features/trust-center/) are all only as good as the SBOM they are built from.

**Just want a working pipeline?** The setup wizard scans your repository, finds your lockfiles, and writes a ready-to-commit CI workflow.
[Run the Setup Wizard](https://sbomify.com/faq/how-do-i-use-the-sbomify-setup-wizard/)

---

## How to Generate an SBOM

Every SBOM generation workflow comes down to four decisions.

### 1. Choose your source: lockfile, image, or build system

This is the decision that matters most, and the easiest one to get wrong.

- **From a lockfile (recommended)** – `uv.lock`, `poetry.lock`, `package-lock.json`, `pnpm-lock.yaml`, `Cargo.lock`, `go.sum`, `gradle.lockfile`, `Gemfile.lock`. A good lockfile already pins an exact version for every transitive dependency, and in most ecosystems a cryptographic hash too, which is precisely what an SBOM needs. In CycloneDX terminology this is a _pre-build_ or _source_ SBOM. Not every ecosystem has one — Maven has no traditional lockfile, since versions in `pom.xml` can be ranges or inherited from parent POMs, which the [Java guide](https://sbomify.com/guides/java/) covers.
- **From an installed environment** – reading what the package manager actually installed. Useful when there is no usable lockfile, but the output inherits whatever the environment happens to contain.
- **From a container image** – scans the image filesystem. Essential for containerised delivery, with an important caveat covered in the [Docker guide](https://sbomify.com/guides/docker/): image scanning sees packages installed by a package manager, and can miss binaries copied in during a multi-stage build.
- **From a build system** – embedded build systems emit their own manifests. See the [Yocto guide](https://sbomify.com/guides/yocto/).

The general rule: **the SBOM is only as good as the lockfile.** A `requirements.txt` with version ranges and no hashes cannot produce an accurate source SBOM, because the exact version is genuinely unknown until install time. If your SBOM quality is disappointing, fix the lockfile before blaming the tool.

### 2. Choose a generation tool

There is no single best SBOM tool — the right one depends on your ecosystem.

| Tool                                              | Best for                  | Notes                                                                                                                                                                      |
| ------------------------------------------------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Native ecosystem tools**                        | A single language         | `cyclonedx-py`, `cyclonedx-maven-plugin` and similar read their own lockfile format directly. Which tool fits which ecosystem is covered per-language in the guides below. |
| **[Syft](https://github.com/anchore/syft)**       | Breadth, container images | Handles many ecosystems and image formats from one binary.                                                                                                                 |
| **[cdxgen](https://github.com/CycloneDX/cdxgen)** | Breadth, monorepos        | Wide language coverage, CycloneDX-native.                                                                                                                                  |
| **[sbomify-action](https://sbomify.com/sbomify-action/)**            | CI/CD, and not choosing   | Bundles the above, selects the right generator for your ecosystem, then enriches and publishes the result in one step.                                                     |

A note on tool safety: we [no longer consider Trivy safe](https://sbomify.com/2026/03/26/trivy-compromise-hardening-sbomify-action/) following two successful supply chain attacks in March 2026, and have removed it from sbomify-action. SBOM tooling sits inside your build pipeline with access to your source and often your registry credentials — it deserves the same scrutiny as any other dependency.

### 3. Choose a format: CycloneDX or SPDX

Both are mature, both are accepted by every major compliance framework, and you do not need to pick a side permanently — see [converting between CycloneDX and SPDX](https://sbomify.com/faq/can-i-convert-between-cyclonedx-and-spdx/) and [which formats sbomify supports](https://sbomify.com/faq/what-sbom-formats-does-sbomify-support/). If you have no existing constraint, either is a safe default; the guides below use CycloneDX output in their examples.

### 4. Automate it in CI

An SBOM generated by hand is out of date the moment the next commit lands. Generate one on every build, from the same lockfile that produced the artefact, and attach it to the release. The [CI/CD integration guide](https://sbomify.com/guides/ci-cd/) covers why this belongs in the pipeline rather than in a quarterly checklist, and [runtimes](https://sbomify.com/sbomify-action/runtimes/) covers GitHub Actions, GitLab CI, Bitbucket, Jenkins, CircleCI, Travis CI, Azure DevOps and TeamCity.

Generation is also the right moment to [sign the SBOM](https://sbomify.com/faq/how-do-i-sign-an-sbom/), while you still have build-time provenance to sign with.

---

## Language Guides

- [Python](https://sbomify.com/guides/python/) - pip, Poetry, Pipenv, uv
- [JavaScript](https://sbomify.com/guides/javascript/) - npm, yarn, pnpm, Bun
- [Java](https://sbomify.com/guides/java/) - Maven, Gradle
- [Go (Golang)](https://sbomify.com/guides/go/) - Go Modules
- [Rust](https://sbomify.com/guides/rust/) - Cargo
- [Ruby](https://sbomify.com/guides/ruby/) - Bundler
- [PHP](https://sbomify.com/guides/php/) - Composer
- [.NET/C#](https://sbomify.com/guides/dotnet/) - NuGet
- [Swift](https://sbomify.com/guides/swift/) - Swift Package Manager
- [Dart/Flutter](https://sbomify.com/guides/dart/) - pub
- [Elixir](https://sbomify.com/guides/elixir/) - Mix
- [Scala](https://sbomify.com/guides/scala/) - sbt
- [C/C++](https://sbomify.com/guides/cpp/) - Conan, vcpkg

## Platform Guides

- [Docker and containers](https://sbomify.com/guides/docker/) - image SBOMs, multi-stage builds, distroless images
- [Terraform](https://sbomify.com/guides/terraform/)
- [Yocto](https://sbomify.com/guides/yocto/) - Embedded Linux
- [PlatformIO](https://sbomify.com/guides/platformio/) - Arduino, ESP32 and other microcontroller firmware
- [Raspberry Pi](https://sbomify.com/guides/raspberry-pi/) - rpi-image-gen
- [CI/CD Integration](https://sbomify.com/guides/ci-cd/) - Why SBOMs belong in your build pipeline

## General Guides

- [How to Version SBOMs](https://sbomify.com/guides/how-to-version-sboms/)

---

## The sbomify Action

The [sbomify action](https://sbomify.com/sbomify-action/) generates an SBOM from any of the lock files above, enriches it, and publishes it - in one step, on any CI platform. It covers 17 ecosystems plus Docker images, directory scans and Yocto builds, and outputs both CycloneDX and SPDX.

- [Full documentation](https://sbomify.com/sbomify-action/) - complete reference for generating SBOMs in any pipeline
- [Quick start](https://sbomify.com/sbomify-action/quickstart/) - Setup wizard and your first run
- [Why SBOM quality matters](https://sbomify.com/sbomify-action/why/) - scanners versus pipelines, and signing at origin
- [Configuration reference](https://sbomify.com/sbomify-action/configuration/) - Every option
- [Runtimes](https://sbomify.com/sbomify-action/runtimes/) - GitHub Actions, GitLab CI, Bitbucket, Jenkins, CircleCI, Travis CI, Azure DevOps, TeamCity and more

---

## After Generation

A generated SBOM is an input, not a deliverable. What usually follows:

- **Enrichment** - filling in licence, supplier and metadata the lockfile does not carry. See [enrichment](https://sbomify.com/sbomify-action/enrichment/) and [augmentation](https://sbomify.com/sbomify-action/augmentation/).
- **Vulnerability monitoring** - continuously, as new CVEs are published against components you already shipped.
- **Compliance** - mapping the SBOM to whichever framework applies to you. The [SBOM compliance guide](https://sbomify.com/compliance/) covers the CISA minimum elements, the [EU Cyber Resilience Act](https://sbomify.com/compliance/eu-cra/), [BSI TR-03183-2](https://sbomify.com/compliance/bsi-tr-03183/), NIS2, FDA and PCI DSS.
- **Distribution** - sharing with customers and auditors without emailing JSON around. See [share and collaborate](https://sbomify.com/share-and-collaborate/).

Worked examples of complete SBOMs are in [SBOM examples](https://sbomify.com/sbom-examples/), and [Zero to Hero](https://sbomify.com/zero-to-hero/) walks the whole path end to end.

## Additional Resources

Looking for more tools and resources? Check out our [SBOM Resources](https://sbomify.com/resources/) page for:

- SBOM generation tools (generic and language-specific)
- Assembly and enrichment tools
- Distribution and transportation solutions
- Analysis and vulnerability scanning tools
- Official SBOM documentation from CISA and NTIA

## Pages

- [CRA obligations: what sbomify covers](https://sbomify.com/guides/cra-obligations/): What sbomify does for each Cyber Resilience Act obligation, from SBOMs and vulnerability handling to support periods and Article 14 reporting, and what stays your responsibility.
- [How to Version SBOMs - SemVer, CalVer, and Rolling Releases](https://sbomify.com/guides/how-to-version-sboms/): Learn best practices for versioning Software Bill of Materials. Guide covers Semantic Versioning, Calendar Versioning, rolling releases, and linking SBOMs to your release process.
- [SBOM Generation Guide for .NET - NuGet](https://sbomify.com/guides/dotnet/): Learn how to generate Software Bill of Materials for .NET and C# projects. Complete guide with packages.lock.json, PackageReference, and Microsoft SBOM Tool examples.
- [SBOM Generation Guide for C/C++ - Conan](https://sbomify.com/guides/cpp/): Learn how to generate Software Bill of Materials for C/C++ projects. Complete guide with conan.lock examples, vcpkg, and handling vendored dependencies.
- [SBOM Generation Guide for Dart and Flutter - pub](https://sbomify.com/guides/dart/): Learn how to generate Software Bill of Materials for Dart and Flutter projects. Complete guide with pubspec.lock examples and CycloneDX output.
- [SBOM Generation Guide for Docker and Containers](https://sbomify.com/guides/docker/): Generate a Software Bill of Materials for Docker images and containers: what image scanning does and does not capture, multi-stage builds, distroless images, signing, and combining container and application SBOMs.
- [SBOM Generation Guide for Elixir - Mix](https://sbomify.com/guides/elixir/): Learn how to generate Software Bill of Materials for Elixir projects. Complete guide with mix.lock examples, Hex packages, and umbrella applications.
- [SBOM Generation Guide for Go - Go Modules](https://sbomify.com/guides/go/): Learn how to generate Software Bill of Materials for Go projects. Complete guide with go.mod and go.sum examples, CycloneDX and SPDX output.
- [SBOM Generation Guide for Java - Maven, Gradle](https://sbomify.com/guides/java/): Learn how to generate Software Bill of Materials for Java projects. Complete guide with pom.xml, build.gradle, and gradle.lockfile examples, CycloneDX and SPDX output.
- [SBOM Generation Guide for JavaScript - npm, yarn, pnpm, Bun](https://sbomify.com/guides/javascript/): Learn how to generate Software Bill of Materials for JavaScript and Node.js projects. Complete guide with package-lock.json, yarn.lock, pnpm-lock.yaml, and bun.lock examples.
- [SBOM Generation Guide for PHP - Composer](https://sbomify.com/guides/php/): Learn how to generate Software Bill of Materials for PHP projects. Complete guide with composer.lock examples, dev dependencies, and CycloneDX output.
- [SBOM Generation Guide for PlatformIO - Arduino, ESP32 and Embedded Firmware](https://sbomify.com/guides/platformio/): Learn how to generate a Software Bill of Materials for PlatformIO firmware projects. Covers platformio.ini, lib_deps pinning, the Arduino-ESP32 and ESP-IDF frameworks, CPEs for vulnerability scanning, and CI setup.
- [SBOM Generation Guide for Python - UV, Poetry, Pipenv](https://sbomify.com/guides/python/): Learn how to generate Software Bill of Materials for Python projects. Complete guide with uv.lock, poetry.lock, and Pipfile.lock examples.
- [SBOM Generation Guide for Raspberry Pi - rpi-image-gen](https://sbomify.com/guides/raspberry-pi/): Learn how to generate Software Bill of Materials for Raspberry Pi custom images using rpi-image-gen. Complete guide with SPDX output and quality analysis.
- [SBOM Generation Guide for Ruby - Bundler](https://sbomify.com/guides/ruby/): Learn how to generate Software Bill of Materials for Ruby projects. Complete guide with Gemfile.lock examples, platform-specific gems, and CycloneDX output.
- [SBOM Generation Guide for Rust - Cargo](https://sbomify.com/guides/rust/): Learn how to generate Software Bill of Materials for Rust projects. Complete guide with Cargo.lock examples, workspace dependencies, and CycloneDX output.
- [SBOM Generation Guide for Scala - sbt](https://sbomify.com/guides/scala/): Learn how to generate Software Bill of Materials for Scala projects. Complete guide with build.sbt examples, cross-compilation, and dependency management.
- [SBOM Generation Guide for Swift - Swift Package Manager](https://sbomify.com/guides/swift/): Learn how to generate Software Bill of Materials for Swift projects. Complete guide with Package.resolved examples, Xcode integration, and CycloneDX output.
- [SBOM Generation Guide for Terraform - Infrastructure as Code](https://sbomify.com/guides/terraform/): Learn how to generate Software Bill of Materials for Terraform projects. Complete guide with .terraform.lock.hcl examples, provider dependencies, and security considerations.
- [SBOM Generation Guide for Yocto - Embedded Linux](https://sbomify.com/guides/yocto/): Learn how to generate Software Bill of Materials for Yocto-based embedded Linux projects. Complete guide covering SPDX 2.2 and SPDX 3.0.1 with bitbake integration.
- [SBOM Generation in CI/CD Pipelines](https://sbomify.com/guides/ci-cd/): Why SBOMs belong in your build pipeline, what to generate on every commit versus every release, and where to find setup instructions for your CI platform.

---

From sbomify: https://sbomify.com/guides/
