macOS10.14+卸载系统软件,以卸载并安装旧版iTunes

2019-03-14  本文已影响0人  雨_田

iTunes官网
iTunes12.6.3下载

一、关闭SIP系统完整性保护 (修复模式环境)

(一)、查看保护状态,打开Mac终端输入命令:csrutil status

  关闭了的是disable,开启了的是enabled。默认情况下是开启。

(二)、已开启(状态为enabled),需要关闭

   1、点击logo重动,同时按住键盘上面的command+r,进入修复模式     
   2、进入终端(选择实用工具Utilities --> 终端Terminal),
   3、终端输入:csrutil disable,按return键,(有可能要求你输入管理员密码)。
   4、点击logo重启电脑。
   5、在终端,重查状态(csrutil status), 如果为disable,则关闭成功。

二、卸载软件,如iTunes (正常模式环境)

(一)、手动删除:

image.png

1、在终端中输入命令: sudo -i 进入到系统的root目录

sudo -i

2、继续输入命令,卸载iTunes

rm -rf /Applications/iTunes.app    

3、删除相关路径下,旧的相关iTunes文件夹

<1>~/Library 路径下
image.png
<2>~/Music 路径下
image.png

(二)、mac自带的脚本编辑器(AppleScript), shell命令删

image.png

方式一:会删除原来iTunes

set question to display dialog "Delete iTtunes?" buttons {"Yes", "No"} default button 1
set answer to button returned of question
if answer is equal to "Yes" then
    do shell script "rm -rf /Applications/iTunes.app" with administrator privileges
    display dialog "iTunes was deleted" buttons {"Ok"}
    set theDMG to choose file with prompt "Please select iTunes 12.6 dmg file:" of type {"dmg"}
    do shell script "hdiutil mount " & quoted form of POSIX path of theDMG
    do shell script "pkgutil --expand /Volumes/iTunes/Install\\ iTunes.pkg ~/tmp"
    do shell script "sed -i '' 's/18A1/14F2511/g' ~/tmp/Distribution"
    do shell script "sed -i '' 's/gt/lt/g' ~/tmp/Distribution"
    do shell script "pkgutil --flatten ~/tmp ~/Desktop/iTunes.pkg"
    do shell script "hdiutil unmount /Volumes/iTunes/"
    do shell script "rm -rf ~/tmp"
end if
if answer is equal to "No" then
    display dialog "iTunes was not deleted" buttons {"Ok"}
    return
end if

set question to display dialog "Install iTtunes?" buttons {"Yes", "No"} default button 1
set answer to button returned of question
if answer is equal to "Yes" then
    do shell script "open ~/Desktop/iTunes.pkg"
    return
end if
if answer is equal to "No" then
    display dialog "Modified iTunes.pkg saved on desktop" buttons {"Ok"}
    return
end if

方式二:不会删除iTunes

display dialog "Please select iTunes 12.6 dmg file" buttons {"Ok"}
set theDMG to choose file with prompt "Please select iTunes 12.6 dmg file:" of type {"dmg"}
do shell script "hdiutil mount " & quoted form of POSIX path of theDMG
do shell script "pkgutil --expand /Volumes/iTunes/Install\\ iTunes.pkg ~/tmp"
do shell script "sed -i '' 's/18A1/14F2511/g' ~/tmp/Distribution"
do shell script "sed -i '' 's/gt/lt/g' ~/tmp/Distribution"
do shell script "pkgutil --flatten ~/tmp ~/Desktop/iTunes.pkg"
do shell script "hdiutil unmount /Volumes/iTunes/"
do shell script "rm -rf ~/tmp"

set question to display dialog "Install iTtunes?" buttons {"Yes", "No"} default button 1
set answer to button returned of question
if answer is equal to "Yes" then
    do shell script "open ~/Desktop/iTunes.pkg"
    return
end if
if answer is equal to "No" then
    display dialog "Modified iTunes.pkg saved on desktop" buttons {"Ok"}
    return
end if

运行时如果 提示 iTunes Library.itl 错误,删掉

终端运行命令:

sudo rm ~/Music/iTunes/iTunes\ Library.itl

三、恢复完整性保护 (修复模式环境)

重复上面一中(二)的步骤,在终端输入如下命令:csrutil enable。成功后会有成功的提示英文。重启,进入正常模式。

上一篇下一篇

猜你喜欢

热点阅读