for sure, we all love icloud. and we all know someone, whom the icloud backup saved a lot of anger. after loosing thousands of pictures a couple of years ago, i really improved in the process of managing multiple backups. wouldn't it be nice to have two independent iphone backups at the same time? having a mac, it's very easy to rely on both, the icloud backup and an additional encrypted itunes backup.


prepare iphone

to begin, connect the iphone to your mac and open it's summary view in itunes by clicking the small iphone icon.

itunes window, iphone screen

next, you should tick the checkboxes labeled sync with this iphone over wi-fi and encrypt iphone backup. a new popup will appear, asking you to enter a secure password. remember: if you ever forget this password, you will not be able to restore your itunes backup. so, go ahead and tick remember this password in my keychain, if you want to.

popup window: create a secure password

please note, that icloud is still checked for the automatical backup. this will ensure, that your iphone will continue creating icloud backups. optional: you don't want to have your iphone backed up to icloud? that's fine. this setup will still work for you.

create the backup script

open textedit.app from the applications folder and paste this text into the window (if your itunes menu is not in english, please update the corresponding menu bar items):

#!/usr/bin/osascript

do shell script "syslog -s -l notice Start backing up devices in iTunes"

tell application "iTunes" to activate
delay 30

tell application "iTunes"
	try
		set devices to (every source whose kind is iPod)
		if (count of devices) > 0 then
			tell application "System Events"
				tell process "iTunes"
					tell menu bar 1
						tell menu bar item "File"
							tell menu "File"
								tell menu item "Devices"
									tell menu "Devices"
										click menu item "Back Up"
									end tell
								end tell
							end tell
						end tell
					end tell
				end tell
			end tell
		end if
	end try
end tell

save the file as CreateBackup.applescript on your desktop.

screenshot: textedit with applescript

using a new finder window, navigate to ~/Library/iTunes and create a new folder, named Scripts. drag and drop the file from your desktop into the new folder.

screenshot: scripts folder

if everything went fine so far, you will see a new icon in the itunes menu bar, the scripts icon.

screenshot: itunes menu bar with script icon

next, run this command in terminal.app to make the applescript executable:

chmod +x ~/Library/iTunes/Scripts/CreateBackup.applescript

launchagent setup

using textedit, create a new text file with this content:

<?xml version="1.0" encoding="UTF-8"?>  
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">  
<plist version="1.0">  
<dict>  
	<key>Label</key>
	<string>one.nerd.iTunesBackups</string>
	<key>Program</key>
	<string>/Users/demo/Library/iTunes/Scripts/CreateBackup.applescript</string>
	<key>StartCalendarInterval</key>
	<dict>
		<key>Hour</key>
		<integer>23</integer>
		<key>Minute</key>
		<integer>0</integer>
	</dict>
</dict>
</plist>

replace demo in this document with your own username, then save it as one.nerd.iTunesBackups.plist to your desktop. note: the backup will be created every evening at 11 pm; don't hesitate to change the time (hour and minute) to your desired values.

using finder, go to folder ~/Library/LaunchAgents and move this file here.

screenshot: launchagents folder

now run the following line, to load the launchagent:

launchctl load -w ~/Library/LaunchAgents/one.nerd.iTunesBackups.plist

next time, we hit the time mentioned, itunes will search for your iphone (via usb/wifi) and if available, create a new backup.


”createbackup.applescript“ would like to control this computer using accessibility features.

screenshot, accessibility popup

if you see a popup asking to grant access, please open system preferences/security & privacy/security/accessibility and tick the checkbox beside CreateBackup.applescript. this is important, because this apple script uses accessibility features/gui scripting to start the backup process. to avoid the annoying popup, you can grant access right away using system preferences.app.

screeshot: system preferences, accessibility

main picture by barn images, license