Getting Swift Matter examples to use the right Swift toolchain

I forgot to set the TOOLCHAINS environment variable when I first installed esp-idf and esp-matter and tried to build, and now even though it’s set, it keeps trying to use the Xcode version. I can't figure out how to get it to seethe new one.

It seems I need to delete the build folder and start over, although it might be enough to idf.py set-target esp32c6 again.

You might need to run source export.sh in the ESP-IDF directory again to ensure the environment variables are set properly. Also, try restarting your terminal to reset any cached environment variables!

1 Like

That's always a good reminder, but it's not the issue here. It seems to cache it somewhere in the build/ dir.

I had a similar issue, maybe take a look here:

The problem is that if you then change the TOOLCHAINS value (say you install a new toolchain), the build system won’t pick that up. Starting over works, and I think setting the target again picks it up.