I'm not sure about MacOs M2, but we've simplified the installation instructions to use https://determinate.systems/, which has a simpler installation and a script to setup the trusted-users
Checkout https://github.com/digitallyinduced/ihp/pull/2082