If you have installed the standalone Command Line Tools for XCode on your Mac (i.e. without having XCode.app installed), some of these tools can get a bit confused due to a couple of oversights on Apple's part in finalising the setup.
Note: all commands below will need to be run from an Administrator account, or by an account with appropriate permission in /etc/sudoers.
1. Failing to Find Frameworks
Sometime when compiling against the preinstalled Frameworks (e.g. Ruby or Python), various tools will inexplicable fail to find header files that are quite clearly there. This is caused by the fact that no XCode has been selected for the command-line tools. Wait, I hear you cry, I don't have XCode installed! Indeed, but you nonetheless need to select one, and point it somewhere where the command line tools exist, like so
sudo xcode-select -switch /usr/bin
Now you may come across another problem - xcrun fails with the following error:
xcrun: Error: failed to exec real xcrun. (No such file or directory)
The standalone command line tools installer seems to not install a valid xcrun binary, so we get this error. This fix is a bit of a messy hack, and involves making a dummy xcrun like so:
sudo mv /usr/bin/xcrun /usr/bin/xcrun-orig sudo vim /usr/bin/xcrun
Enter the following into your dummy xcrun file:
#!/bin/sh exec "$@"
Now make it executable:
sudo chmod 755 /usr/bin/xcrun
And all should be right with the world!
Credit Where Credit Is Due
I did not work this out myself - I just managed to eventually find answers to both of these problems by searching around.