Skip to content

Instantly share code, notes, and snippets.

@ChristianKienle
Created April 20, 2020 07:13
Show Gist options
  • Save ChristianKienle/05d4a689d5a6eabf287de833ec72eadc to your computer and use it in GitHub Desktop.
Save ChristianKienle/05d4a689d5a6eabf287de833ec72eadc to your computer and use it in GitHub Desktop.
'use strict';
const { exec, spawnSync } = require('child_process');
const path = require('path');
const home = process.env['HOME'];
if(!home) {
console.error('home not set');
process.exit(1);
return;
}
const killXcode = spawnSync('killall', ['Xcode']);
const killXcodeStatus = killXcode.status;
if(killXcodeStatus !== 0) {
const killError = killXcode.stderr.toString();
console.log(`Failed to terminate Xcode. killall did exit with ${killXcodeStatus} - stderr: ${killError}.`);
}
const derivedData = path.join(home, 'Library', 'Developer', 'Xcode', 'DerivedData');
console.log(`Will delete ${derivedData}`);
exec(`rm -rf ${derivedData}`, (err, stdout, stderr) => { });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment