Removing calendar off ipod touch and iPhone hack

It seems a well documented problem that if you sync your iPod Touch or iPhone with your machine. then decide to change to a different calendar, it can be really hard to get rid of the older calendar, especially if like me, you sync with google apps then decide to go with the exchange option.

So now im stick with 2 or three copies of my gmail calendar on my iPhone, which no matter WHAT i try does not go away, even after i tell it to not sync any calendars in iTunes.

Luckily i Jailbreak my iphone, i ssh’d in and found where the calendar files are. This fix im afraid only works with a jail broken iPod/iPhone.

ssh in or open a console. If you have file browser you prefer then by all means use that. You need to grab the file at /private/var/mobile/Library/Calendar/Calendar.sqlitedb .

You can use scp to do this, find the IP of the device, then

an7:Desktop wishes$ scp root@10.40.1.5:/private/var/mobile/Library/Calendar/Calendar.sqlitedb .
root@10.40.1.5’s password:
Calendar.sqlitedb                                                                                                                 100%  636KB 636.0KB/s   00:01

Once you have the file, you need an SQLite browser to edit it. I used http://sourceforge.net/projects/sqlitebrowser/ on my mac. Make a backup of the sql file before editing it. Open it in the sqlite browser. Click ‘Browse Data’ then in the drop down look at Calendar. Find the entry you dont want, delete it, then save the database again.

Copy it back to the device.

lan7:Desktop wishes$ scp Calendar.sqlitedb root@10.40.1.5:/private/var/mobile/Library/Calendar/Calendar.sqlitedb
root@10.40.1.5’s password:
Calendar.sqlitedb                                                                                                                 100%  524KB 524.0KB/s   00:00

Then test it. If it worked then presto! if not you still have that backup right?.

Removing iPhone or iPod Touch Calendar that wont disappear

I had a problem with my iPhone, i had previously added my google calendars to sync with iCal on the mac so they synced with my iPhone. THis was great except i couldn’t add things to them from the iPhone.

When Google allowed exchange access i just set that up and used it, problem was that I could no longer get rid of the old ones. I even set iTunes to sync NO calendars and deleted it all, and still i had a couple of these old calendars hanging about.
I figured since I had jail broken my iPhone i should be able to look around the filesystem and see what the problem was. Fairly quickly i found in the user ‘mobile’ home dir the files Library/Calendar/Calendar.sqlitedb (fullpath /private/var/mobile/Library/Calendar/Calendar.sqlitedb ) .
I grabbed an sqllite editor from http://sourceforge.net/projects/sqlitebrowser/ , copied the file over to my local Linux machine.
Opened the file in sqllite editor, went to Browse Data’ then changed the dropdown to ‘Calendar’. Deleted the offending Calendars, saved and re-uploaded.
Make sure you change the ownership so the mobile user can write to it!
Hermes:/User/Library/Calendar root# chown mobile.mobile Calendar.sqlitedb

Now before you get cocky, make a backup before you overwrite the original eh? Just in case you bugger things up!

Command history

wishes@tulip:~$ scp root@192.168.0.28:/User/Library/Calendar/Calendar.sqlitedb .
root@192.168.0.28’s password:
Calendar.sqlitedb 100% 716KB 716.0KB/s 00:01
wishes@tulip:~$ tar zvxf sqlitebrowser-1.3-i386.tar.gz
sqlitebrowser
wishes@tulip:~$ ./sqlitebrowser
wishes@tulip:~$ scp Calendar.sqlitedb root@192.168.0.28:/User/Library/Calendar/Calendar.sqlitedb-new
root@192.168.0.28’s password:
Calendar.sqlitedb 100% 552KB 552.0KB/s 00:00
wishes@tulip:~$ ssh root@192.168.0.28
root@192.168.0.28’s password:
Hermes:~ root# cd /User/Library/Calendar/
Hermes:/User/Library/Calendar root# ls
Calendar.sqlitedb Calendar.sqlitedb-new
Hermes:/User/Library/Calendar root# mv Calendar.sqlitedb Calendar.sqlitedb-old
Hermes:/User/Library/Calendar root# mv Calendar.sqlitedb-new Calendar.sqlitedb
Hermes:/User/Library/Calendar root# chown mobile.mobile Calendar.sqlitedb
Hermes:/User/Library/Calendar root# logout
Connection to 192.168.0.28 closed.