I am trying to compile for the first time the matter led-blink or the smart-light examples and I am getting the following error when I run

idf.py set-target esp32c6

or

idf.py build
CMake Error at esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip/CMakeLists.txt:348 (message):
  The 'gn' command was not found.  Make sure you have GN installed.Or have
  followed necessary build preparations stated in BUILDING.md.

I am able to successfully build the hello-world project that comes with the esp-idf

This is my first time working with this sorry if this is a dumb question or if I missed a step. I tried to go back and make sure I have completed all the steps.

cmake version 3.30.1
ESP-IDF v5.4-dev-1523-gaf25eb447e-dirty

I also have the environment variable TOOLCHAINS=org.swift.59202407221a

The 'gn' command was not found

This sounds like some missing step in the installation and activation of ESP IDF and/or ESP Matter SDKs? There's this step-by-step guide (by @rauhul) that should describe exactly how to set those up: https://apple.github.io/swift-matter-examples/tutorials/swiftmatterexamples/setup-macos/

I think the missing step is one of these:

  • cd ~/esp/esp-idf ; ./install.sh
  • cd ~/esp/esp-matter ; ./install.sh
  • . ~/esp/esp-idf/export.sh
  • . ~/esp/esp-matter/export.sh