Either the command line tools you need aren’t installed or they are not properly installed. You can check that by entering the following command in the Terminal window:
xcode-select -p
If it is installed, you should see this:
/Library/Developer/CommandLineTools
If not, run the following command to try to force an install via the command line in the terminal:
xcode-select --install
That should spawn a dialog box asking you to install the Xcode command line tools. Click Install and then try the commands I mentioned in the original post again.