To delete all derived data and the module cache in /var/folders
use this little ruby script.
derivedDataFolder = Dir.glob(Dir.home + "/Library/Developer/Xcode/DerivedData/*")
moduleCache = Dir.glob("/var/folders/**/com.apple.DeveloperTools*")
FileUtils.rm_rf derivedDataFolder + moduleCache
This just solved a fatal error: malformed or corrupted AST file: 'Unable to load module "/var/folders/
error for me.