Reinstalling XCode and updating Homebrew should be enough. To do this:
- Try the
uninstall-devtools script from this answer to remove older XCode versions. (If it doesn't work or you can't find it, don't worry about it.)
- Delete the entire /Developer directory if it exists. This is where older versions of XCode live.
- Download and install the latest XCode for your OS version. (The App Store makes this easy.)
- Install the Command Line Tools. In XCode, go to the Apple menu, select Preferences, select the Downloads section, and click Install next to Command Line Tools.
- Update the Homebrew definitions and packages with
brew update && brew upgrade.
- If any brewed packages still seem broken,
brew rm them and
brew install --fresh to reinstall.
- Edit your shell config file (e.g.
~/.bashrc) to make sure
/usr/local/bin is on your path.
brew doctor can help diagnose this and other issues.
tms is designed to install to
/usr/lib by default, which you won't have permissions to do in a normal OS X setup even once you have all the tools installed, because the OS reserves
/usr for its own use. You'll probably want to fiddle with the
tms.h to get it in to
/opt, which are easier places to drop user-built packages.
If you're feeling ambitious, you could even do
brew create http://jonathanscorner.com/download/tms1_4.tar.gz to make a Homebrew formula for TMS, making repeated installs easier.