Created
April 20, 2020 07:13
-
-
Save ChristianKienle/05d4a689d5a6eabf287de833ec72eadc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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