我目前使用OSX10.10,需要使用MATLAB;但是因爲他們沒有更新應用程序來支持10.10,它會在啓動時崩潰。到目前爲止,我一直在使用pico編輯SystemVersion.plist [1](將版本從10.10更改爲10.9)。除了每次我需要打開MATLAB並在每次關閉MATLAB時重新編輯它都非常煩人。自動編輯SystemVersion.plist
我想要做的是當我啓動腳本時,它會將SystemVersion.plist編輯爲正確的版本,以便我可以運行MATLAB而不會崩潰;然後當MATLAB退出時,它將版本從10.9重置爲10.10)。我有一些代碼(可能寫得不好,我以前從未使用過蘋果腳本);
tell application "System Events"
set ProcessList to name of every process
if "MATLAB" is in ProcessList then
tell application "System Events"
tell property list file "/System/Library/CoreServices/SystemVersion.plist"
tell contents
set value of property list item "ProductUserVisibleVersion" to "10.9"
set value of property list item "ProductVersion" to "10.9"
end tell
end tell
end tell
else
tell application "System Events"
tell property list file "/System/Library/CoreServices/SystemVersion.plist"
tell contents
set value of property list item "ProductUserVisibleVersion" to "10.10"
set value of property list item "ProductVersion" to "10.10"
end tell
end tell
end tell
end if
end tell
[1] - Error trying to installing JDK8 U11 OSX 10.10 Yosemite
這很好,但是,我發現我需要更改SystemVersion.plist的文件許可權以便腳本訪問它。您正在使用哪個文件權限(我目前使用776-rwxrwxrw-;但這有點不安全) – Zongor 2014-10-19 14:46:03
我已經添加了我的用戶以在SystemVersion.plist上具有讀取和寫入權限。可能不是最好的解決方案,但是現在,直到MathWorks提出解決方案之前,我不知道該怎麼做。有什麼建議麼? – Jens 2014-10-24 08:06:37