我目前使用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