One of the big problems with jailbreaking is that iTunes still serves you iOS updates, which, if downloaded, will return your phone to a non-jailbroken state. To avoid an accidental overwrite, run this bash script to prevent iTunes from automatically downloading updates.
The script, built for Mac users, is pretty simple: it just changes the permissions of iTunes’ download directories for software updates. When it tries to download an update, it will be denied permission and the download will just fail. If you have a jailbroken device, you can then just manually download the firmware and do an option-restore as usual to update your device. To use it, just copy and paste the following script into TextEdit:
echo “This script will chmod the download locations for Firmware Files, So iTunes can not download firmware.”
echo “AKA it will prevent iTunes from auto updating your device.”
echo “To restore firmware just hold down option and manually select the firmware file.”
echo “Made By: Wesley K”
echo “[email protected]”
read -sn 1 -p “Press any key to continue…”
echo “Now I need your password to continue”
echo “Killing iTunes now”
sudo killall -9 iTunes
echo “Im going to make all the folder needed to future proof a few things”
echo “If errors occur here, No big deals.”
sudo mkdir ~/Library/iTunes/iPad Software Updates/
sudo mkdir ~/Library/iTunes/iPod Software Updates/
sudo mkdir ~/Library/iTunes/iPhone Software Updates/
echo “I am going to dump all the current files in your update folders.”
echo “This will prevent any updates from downloaded firmware.”
sudo rm -rf ~/Library/iTunes/iPad Software Updates/*
sudo rm -rf ~/Library/iTunes/iPhone Software Updates/*
sudo rm -rf ~/Library/iTunes/iPod Software Updates/*
echo “Now preventing iTunes from downloading new firmwares.”
sudo chmod 444 ~/Library/iTunes/iPad Software Updates
sudo chmod 444 ~/Library/iTunes/iPod Software Updates
sudo chmod 444 ~/Library/iTunes/iPhone Software Updates
echo “Made By Wesley K”
echo “Give me credit if you use it”
echo “For safe measures I would run this script after iTunes updates, It shouldn’t affect it but I don’t know yet.”
In TextEdit, go to Format > Make Plain Text. Then save the file wherever you want — somewhere permanent, since you may need it later — as blockitunesupdates.sh, or whatever you want (as long as it has a .sh extension).
Then, open up a terminal window and type chmod +x filepath, where filepath is the path to the script. To run it, just drag the script file into a Terminal window, hit Enter, and follow the prompts. We’ve detailed the process with a similar script in this video if you’d like to follow along.
Note that if you update iTunes, OS X or repair disk permissions with Disk Utility at any time, you may need to run this script again to make sure iTunes stays locked out. If you ever want to undo the script, you can just replace the three 444s in the script with 755 and run it again. Hit the link to read more, and let us know how it works for you in the comments.
Prevent iTunes from Updating Jailbroken Devices [Mac OS X Hints]