Skip to content

Instantly share code, notes, and snippets.

@tanpengsccd
Created October 29, 2018 08:22
Show Gist options
  • Save tanpengsccd/fd7579c9b065f3c84641a2e4b0b5b46e to your computer and use it in GitHub Desktop.
Save tanpengsccd/fd7579c9b065f3c84641a2e4b0b5b46e to your computer and use it in GitHub Desktop.
mac 10.14 install 12.6.x itunes.scpt
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment