When you cd into a nRF Connect SDK workspace directory, the correct NCS toolchain environment will be automatically sourced in your shell.
See https://www.hackster.io/cdwilson/automatically-activate-zephyr-build-environments-with-direnv-65af9c for more info.
- Install direnv on macOS or Linux.
- Install NCS toolchains using nrfutil, e.g.
nrfutil sdk-manager toolchain install --ncs-version v3.1.0 - Copy this
.envrcto the root of your NCS project workspace cdinto the workspace dir (the first time, you'll need to rundirenv allow)
If everything worked correctly, you should see output like the following:
direnv: loading ~/path/to/your/workspace/.envrc
direnv: export +GIT_EXEC_PATH +GIT_TEMPLATE_DIR +ZEPHYR_BASE +ZEPHYR_SDK_INSTALL_DIR +ZEPHYR_TOOLCHAIN_VARIANT ~PATH