platform-espressif32 icon indicating copy to clipboard operation
platform-espressif32 copied to clipboard

Apple Silicon: PlatformIO fails with "Unknown system error -86" due to prebuilt Ninja

Open italocjs opened this issue 4 months ago • 1 comments

On macOS (Apple Silicon M4), building ESP32 projects fails when PlatformIO tries to run its prebuilt tool-ninja package. The error is:

CMake Error at .../project.cmake:381 (__project):
  Running
   '/Users/username/.platformio/packages/tool-ninja/ninja' '--version'
  failed with:
   Unknown system error -86

This happens even after:

  • Installing PlatformIO via Homebrew
  • Installing system-native Ninja and CMake
  • Removing ~/.platformio/packages/tool-ninja and other caches

Steps to Reproduce:

  1. On macOS, install VSCode.
  2. Install PlatformIO via Homebrew: brew install platformio.
  3. Create a new ESP32 project using ESP-IDF + Arduino framework.
  4. Attempt to build: platformio run --environment esp32dev -v.

Expected behavior:

  • PlatformIO should use system-native Ninja or properly install an Apple Silicon-compatible Ninja.
  • The project should build without error -86.

Actual behavior:

  • PlatformIO downloads its prebuilt tool-ninja (x86_64) and fails to execute on Apple Silicon, giving Unknown system error -86.

System info:

macOS Version: 26.0.1 (Build 25A362) Architecture: arm64 (Apple Silicon) PlatformIO Core: 6.1.18 VSCode: 1.105.1 (Universal)

italocjs avatar Oct 19 '25 18:10 italocjs

Note: Following the esp-idf instructions for install have helped and I can now compile normally, it would be nice to have this done automatically though, or at least stated in the install instructions from platformio.

From espressif (https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/linux-macos-setup.html#for-macos-users)

Install CMake & Ninja build:
> brew install cmake ninja dfu-util

install ccache for faster builds. 
> brew install ccache

Not sure if it changed anything but I have also installed the arm exclusive version of vscode instead of universal.

italocjs avatar Oct 19 '25 18:10 italocjs