How to fix error “Could not detect Mac OS X Versio

2019-01-16 14:56发布

I installed appium-1.5.3.dmg But when I click the stethoscope button the Appium is show error :

 ✔ Xcode is installed at: /Library/Developer/CommandLineTools
[Error: Could not detect Mac OS X Version from sw_vers output: '10.12
']

enter image description here

Thank you!

2条回答
一夜七次
2楼-- · 2019-01-16 15:42

I went through the above steps even though I saw that it's been fixed by appium already.

Just run:

npm install appium-doctor -g

to update appium-doctor itself, then run:

appium-doctor

again to see it work.

Before and after fix:

enter image description here

查看更多
在下西门庆
3楼-- · 2019-01-16 15:55

It' worked for me.

You can config file by this command:

  • grep -rl "Could not detect Mac OS X Version from sw_vers output:" /Applications/Appium.app/

enter image description here

  • 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 and config each file.

Example

vim /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/build/lib/system.js

enter image description here

Config file:

enter image description here

  1. 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;


vim /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/lib/system.js

enter image description here

Config file:

enter image description here

  1. Change From ->

    try { stdout = (await exec('sw_vers', ['-productVersion'])).stdout; }

    To ->

    try { stdout = (await exec('sw_vers', ['-productVersion'])).stdout.trim(); }

  2. 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; } }


vim /Applications/Appium.app//Contents/Resources/node_modules/appium-support/build/lib/system.js

enter image description here

Config file:

enter image description here

  1. 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;


vim /Applications/Appium.app//Contents/Resources/node_modules/appium-support/lib/system.js

enter image description here

Config file:

enter image description here

  1. Change From ->

    try { stdout = (await exec('sw_vers', ['-productVersion'])).stdout; }

    To ->

    try { stdout = (await exec('sw_vers', ['-productVersion'])).stdout.trim(); }

  2. 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 stethoscope button

enter image description here

查看更多
登录 后发表回答