Pixi run mojo build fails to detect C++ compiler on macOS arm64

TL;DR

pixi run mojo build hello.mojo fails with “unable to find suitable c++ compiler for linking” even though

  • pixi run mojo hello.mojo (interpreted mode) works, and
  • activating the env and running mojo build hello.mojo works.

Adding [activation.env] with explicit CC/CXX pointing at Homebrew LLVM did not resolve the failure.

Question

I’m curious why does pixi run mojo build fail to detect a compiler while:

  • pixi run mojo and
  • mojo build inside an activated pixi shell

both succeed?

Although I am able to run the mojo programs, I hope to gain a deeper understanding of how mojo build works under the hood. Thank you so much!


Environment

  • macOS (Darwin 24.x, arm64)
  • Mojo / MAX 25.4 via Modular channel
  • Pixi 0.34+
  • pixi.toml (minimal repro):
[workspace]
name       = "my-first-mojo-project"
channels   = ["https://conda.modular.com/max", "conda-forge"]
platforms  = ["osx-arm64"]
version    = "0.1.0"

[dependencies]
max = "==25.4"

Reproduction

Add hello.mojo to the project root directory:

def main():
    print("Hello, world!")
pixi run mojo hello.mojo

pixi run mojo build hello.mojo

For comparison, below succeeds:

pixi activate
mojo build hello.mojo

I don’t see the same locally on my macOS system (Darwin 24.5.0, macOS 15.5) using the latest nightly, but haven’t tried the 25.4 stable release. Both pixi run mojo and pixi run mojo build produce the correct output or binary with your hello world example.

Have you installed the Xcode Command Line Tools on your system?

Thank you for the reply! I have installed xcode.

❯ xcode-select -p
/Library/Developer/CommandLineTools
❯ xcode-select --version
xcode-select version 2409.
❯ clang --version
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin24.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin