Merge branch 'master' into deva/semver
diff --git a/package.json b/package.json
index 069be43..70a7c96 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,7 @@
     "url": "https://github.com/ios-control/ios-deploy"
   },
   "devDependencies": {
+	"semver": "*"
     "eslint": "~4.19.1",
     "eslint-config-semistandard": "^12.0.1",
     "eslint-config-standard": "^11.0.0",
diff --git a/src/scripts/check_reqs.js b/src/scripts/check_reqs.js
index d974234..d1c7b67 100755
--- a/src/scripts/check_reqs.js
+++ b/src/scripts/check_reqs.js
@@ -3,6 +3,7 @@
 var util = require('util');
 var os = require('os');
 var child_process = require('child_process');
+var semver = require('semver')
 
 var XCODEBUILD_NOT_FOUND_MESSAGE = 'Please install Xcode from the Mac App Store.';
 var TOOL = 'xcodebuild';
@@ -19,7 +20,19 @@
 
 xcode_version.on('close', function (code) {
 	if (code === 0) {
-		if (parseInt(os.release().split('.')[0]) >= 15) { // print the El Capitan warning
+		var arr = version_string.match(/^Xcode (\d+\.\d+)/);
+		var ver = arr[1];
+
+		if (semver.gte(os.release(), '15.0.0') && semver.lt(ver + '.0', '7.0.0')) {
+			console.log(util.format('You need at least Xcode 7.0 when you are on OS X 10.11 El Capitan (you have version %s)', ver));
+			process.exit(1);
+		}
+
+		if (ver < XCODEBUILD_MIN_VERSION) {
+			console.log(util.format('%s : %s. (you have version %s)', TOOL, XCODEBUILD_NOT_FOUND_MESSAGE, ver));
+		}
+
+		if (os.release() >= '15.0.0') { // print the El Capitan warning
 			console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
 			console.log('!!!! WARNING: You are on OS X 10.11 El Capitan or greater, you may need to add the');
 			console.log('!!!! WARNING:   `--unsafe-perm=true` flag when running `npm install`');