How self-contained, isolated environments eliminate "it works on my machine" syndrome and boost build consistency

By The Coding Gopher

Published: 2026-04-28

URL: https://thecodinggopher.substack.com/p/hermetic-software-explained


In software engineering, a process is hermetic if it is completely self-contained and isolated from the outside world. It does not rely on anything installed on the host operating system (like system libraries, environment variables, or the specific version of a compiler you happen to have).

How we use hermetic, ephemeral test environments at Google to reduce flakiness | by Carlos Arguelles | Medium

If a process is hermetic, the result is deterministic: giving it the same input will guarantee the exact same output, regardless of which computer it runs on or when it is run.

Hermetic Builds

A Hermetic Build ensures that your code compiles exactly the same way on your laptop, your coworker’s laptop, and the Continuous Integration (CI) server. In a non-hermetic (standard) build, you might use the version of Python or C++ installed globally on your machine (e.g., in /usr/bin). If you upgrade your OS, your build might suddenly break because the compiler changed.

In a hermetic build, the build tool itself downloads or contains the specific compiler and libraries it needs. It creates a “sandbox” where only explicitly declared tools are allowed. Tools like Bazel (used by Google) are famous for enforcing this. They declare: “I don’t care what version of Java is on your computer; I am going to use this specific version of Java that I control.”

What is Reproducibility and why does it matter?

Hermetic builds are self-contained, reproducible software builds that produce identical output from the same inputs, regardless of the host environment. By eliminating dependencies on pre-installed libraries or network access, they ensure consistency across different machines, reduce build failures, and enable reliable caching.

Open-source Bazel Build Tutorial, Examples, and Advantages

𝐋𝐞𝐚𝐫𝐧 𝐭𝐨 𝐛𝐮𝐢𝐥𝐝 𝐆𝐢𝐭, 𝐃𝐨𝐜𝐤𝐞𝐫, 𝐑𝐞𝐝𝐢𝐬, 𝐇𝐓𝐓𝐏 𝐬𝐞𝐫𝐯𝐞𝐫𝐬, 𝐚𝐧𝐝 𝐜𝐨𝐦𝐩𝐢𝐥𝐞𝐫𝐬, 𝐟𝐫𝐨𝐦 𝐬𝐜𝐫𝐚𝐭𝐜𝐡. Get 40% OFF CodeCrafters: <https://app.codecrafters.io/join?via=the-coding-gopher>

This Substack is reader-supported. To receive new posts and support my work, consider becoming a free or paid subscriber.

Hermetic Testing

Hermetic Testing applies the same isolation principle to test environments. A non-hermetic test might connect to a shared development database or call a live external API (like Stripe or Google Maps). If the internet goes down or someone else changes data in that shared database, your test fails, even if your code is perfect.

This is called “flakiness.” A hermetic test spins up its own private, throw-away dependencies (like a local database container or a mock API server) every time it runs. It ensures that the test has total control over the world it lives in, eliminating external noise and preventing tests from interfering with each other.

How we use hermetic, ephemeral test environments at Google to reduce flakiness | by Carlos Arguelles | Medium

Hermetic testing ensures software tests are completely self-sufficient, isolated, and reproducible by removing external dependencies like networks, databases, or third-party services. By controlling all inputs/outputs—often using mocks or stubs and dedicated data—these tests prevent flakiness, guaranteeing that a failure indicates a real issue rather than an environmental dependency error.

Why It Matters

The primary benefit of hermeticity is Reproducibility. The “it works on my machine” problem disappears because “your machine” no longer matters; the environment is defined by the code repo, not the hardware.

However, achieving this is difficult. It requires strict discipline to declare every single dependency (down to the font files or system packages). It often means the initial setup is slower because the system has to download its own tools rather than using what is already there.

But for large teams, this trade-off is essential to prevent “dependency hell.”

It Works On My Computer : r/ProgrammerHumor

This Substack is reader-supported. To receive new posts and support my work, consider becoming a free or paid subscriber.

Thanks for reading! This post is public so feel free to share it.