Environment not working anymore on macos

None of the solutions worked for me perfectly. What finally worked for me on my Mac (Apple Silicone) was to go on the App Store and install x-code, and then installing it in Settings. Somehow that resolved the issue for me. Hope this helps.