Solution Appium Error: “Could not detect Mac OS X Version from sw_vers output: ‘10.12 ‘
You can config file by this command:
- grep -rl “Could not detect Mac OS X Version from sw_vers output:” /Applications/Appium.app/
-
Terminal will show : /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/build/lib/system.js /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/lib/system.js /Applications/Appium.app//Contents/Resources/node_modules/appium-support/build/lib/system.js /Applications/Appium.app//Contents/Resources/node_modules/appium-support/lib/system.js
-
Use command vim or any text editor and config each file.
Example
a) vim /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/build/lib/system.js
-
Change From -> case 10:
_arr = [‘10.8’, ‘10.9’, ‘10.10’, ‘10.11’];
_i = 0;To -> case 10:
_arr = [‘10.8’, ‘10.9’, ‘10.10’, ‘10.11’,’10.12′];
_i = 0;
b) vim /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/lib/system.js
Change From -> try {
stdout = (await exec(‘sw_vers’, [‘-productVersion’])).stdout;
}
To -> . try {
stdout = (await exec(‘sw_vers’, [‘-productVersion’])).stdout.trim();
}
Change From ->for (let v of [‘10.8’, ‘10.9’, ‘10.10’, ‘10.11’]) {
if (stdout.indexOf(v) === 0) { return v; }
}
To -> . for (let v of [‘10.8’, ‘10.9’, ‘10.10’, ‘10.11’,’10.12′]) {
if (stdout.indexOf(v) === 0) { return v; }
}
c) vim /Applications/Appium.app//Contents/Resources/node_modules/appium-support/build/lib/system.js
Change From -> . case 10:
_arr = [‘10.8’, ‘10.9’, ‘10.10’, ‘10.11’];
_i = 0;
To -> . case 10:
_arr = [‘10.8’, ‘10.9’, ‘10.10’, ‘10.11’,’10.12′];
_i = 0;
d) vim /Applications/Appium.app//Contents/Resources/node_modules/appium-support/lib/system.js
Change From -> . try {
stdout = (await exec(‘sw_vers’, [‘-productVersion’])).stdout;
}
To -> . try {
stdout = (await exec(‘sw_vers’, [‘-productVersion’])).stdout.trim();
}
Change From -> . for (let v of [‘10.8’, ‘10.9’, ‘10.10’, ‘10.11’]) {
if (stdout.indexOf(v) === 0) { return v; }
}
To -> . for (let v of [‘10.8’, ‘10.9’, ‘10.10’, ‘10.11’,’10.12′]) {
if (stdout.indexOf(v) === 0) { return v; }
}
Click start the Appium Doctor
button