New method, tested on beta 19A526h
The script asks for iTunes 12.6.5.3 dmg, mounts the image, extracts iTunes.app, modifies
Info.plist and version.plist to 13.6.5, then offers to copy the modified iTunes.app to /Applications, save it in a dmg and create a package that can be installed.
Just copying the modified app to /Applications seems to work. It doesn't require disabling SIP or mounting the system volume.
Code:
set theDMG to choose file with prompt "Please select iTunes 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 "hdiutil unmount /Volumes/iTunes/"
do shell script "cd ~/tmp/iTunesX.pkg;" & "cat Payload | gunzip -dc |cpio -i;" & "cd ~/tmp/iTunesX.pkg/Applications;" & "cp -r iTunes.app ~/tmp;"
do shell script "plutil -replace CFBundleGetInfoString -string 'iTunes 13.6.5.3' ~/tmp/iTunes.app/Contents/Info.plist"
do shell script "plutil -replace CFBundleShortVersionString -string 13.6.5 ~/tmp/iTunes.app/Contents/Info.plist"
do shell script "plutil -replace CFBundleVersion -string 13.6.5 ~/tmp/iTunes.app/Contents/Info.plist"
do shell script "plutil -replace CFBundleVersion -string 'iTunes 13.6.5.3' ~/tmp/iTunes.app/Contents/version.plist"
do shell script "plutil -replace CFBundleShortVersionString -string 13.6.5 ~/tmp/iTunes.app/Contents/version.plist"
set question to display dialog "Copy patched iTunes to /Applications?" buttons {"Yes", "No"} default button 1
set answer to button returned of question
if answer is equal to "Yes" then
do shell script "cp -r ~/tmp/iTunes.app /Applications"
display dialog "Patched iTunes.app was copied to /Applications" buttons {"Ok"}
end if
set question to display dialog "Save patched iTunes as dmg?" buttons {"Yes", "No"} default button 1
set answer to button returned of question
if answer is equal to "Yes" then
do shell script "hdiutil create -format UDZO -srcfolder ~/tmp/iTunes.app ~/Desktop/iTunes13.6.5.dmg"
display dialog "iTunes13.6.5.dmg saved on Desktop" buttons {"Ok"}
end if
set question to display dialog "Save patched iTunes as installable pkg?" buttons {"Yes", "No"} default button 1
set answer to button returned of question
if answer is equal to "Yes" then
do shell script "productbuild --component ~/tmp/iTunes.app /Applications ~/Desktop/iTunes13.6.5.pkg"
display dialog "iTunes13.6.5.pkg saved on Desktop" buttons {"Ok"}
end if
set question to display dialog "Delete temporary ~/tmp folder?" buttons {"Yes", "No"} default button 1
set answer to button returned of question
if answer is equal to "Yes" then
do shell script "rm -R ~/tmp"
display dialog "~/tmp was deleted" buttons {"Ok"}
return
end if
I haven't tested, but the script should also work with iTunes 12.8 dmg.
For an unknown reason, the same script doesn't work in Mojave. Instructions for Mojave in
post 213.