Fixing iPhone Mail Crashes (2.0 Firmware)

Sometimes your iPhone mail client just doesn’t go. You open mail, and it closes again. You can’t even delete the account from the Setup application. I’m not 100% positive, but I think this usually happens when you’ve restored your settings from a pre-2.0 phone (again, unsure whether it matters if the phone was pwned or not).

You could wait for Apple to fix this bug, but with the new jailbreak tool available for 2.0 firmware, help is at hand. Jailbreaking your phone is fairly trivial, but beyond the scope of this post.

Update: Now I see there is a “Mobile Terminal” app available on Cydia. If you’re desperate you can install that, run it, enter “su” to elevate yourself to root (you’ll need the “alpine” password) then skip down to the cd /var/mobile/Library bit.
Update 2: Even easier, the BossPrefs application (available via Cydia) has an option to “Fix User Dir Permissions” (accessed via the “More” button). This does exactly the same thing as my fix below, but is heaps easier if you don’t understand Unix terminal commands.

Read on for the full details

So let’s run through what you need:

  • One iPhone with 2.0 firmware, jailbroken and diced finely.
  • One tablespoon of OpenSSH, installed using the Cydia installer on your iPhone.
  • The IP address of your iPhone when connected via Wifi (sorry USB won’t work).

To grab the IP address, head into the Wifi settings, and tap the blue “more” arrow on the connected network:

Ok, now we need to connect to that IP address using SSH. I use the Terminal app on my Mac, but you could just as easily use PuTTy on your PC. In PuTTy you’ll need to just type in the IP address to connect to. On the Mac you want to type ssh into Terminal (where xxx.etc. is the IP address of the iPhone).

The first time you do this, you will get a long (as in 60+ seconds) delay as the iPhone computes some cryptography stuff (a key pair I think), then it will ask you if you want to accept the key pair. Obviously you do. Type “yes” on the Mac or just click “OK” if you are using PuTTy.

Next we log in with the ubuquitous iPhone root password: alpine. You should get something like this:

Now we have an interactive shell with the iPhone. Hopefully everyone knows some basic Unix shell commands, because they teach those at primary school nowadays right? Right?! Anyway… your mail is stored at /var/mobile/Library/Mail. Let’s take a look at that directory on an iPhone with “broken” mail by typing:

cd /var/mobile/Library
ls -la

See that bit that says “root mobile” on the line tha ends in “Mail/”? That means the Mail directory is owned by user “root” and group “mobile”. This is a Bad Thing(TM). We want it to be owned by user “mobile”, which is the user under which all iPhone apps run. This is an easy fix using the chown command with “-R” (for recurse directories):

chown -R mobile:mobile /var/mobile/Library/Mail

Type that command, hit enter, and we’re done. Take another look at that directory listing now:

All fixed. Now go and run your iPhone mail app and whoop with delight. That’s an order.

And I can’t leave without my standard nag: I OWN this piece of hardware. It’s mine. I shouldn’t have to hack it to fix it. Grrr.


  1. Geniussssssss. Many thanks for providing those guidelines and explnantions, all perfectly working now!

  2. THANK YOU SOOO MUCH!! I was noodling on this all night. I tried every way I could to do it through settings and the iPhone Settings > Mail. None of them worked.

    The directory listing didn’t change right away on mine, but everything still worked.

  3. Wow, it sounds like you’ve typed in a command incorrectly? All my app store
    apps are fine. Without knowing what you’ve done, the simplest way to revert
    the settings would be to re-restore your ipsw file. I’ll have a quick play
    to see if I can break my Apps to see what you might have done.

  4. Hmm strange. I can’t seem to get my apps to break even if I trample (chown mobile:mobile) all over the /var/mobile/Applications directory.

  5. Hi there, thanks for the instructions. im having trouble connecting to the iphone over WiFi (Connection Refused) and through the mobile terminal (Operation not permitted)

    Any help would be much appreciated!
    thanks again

  6. ok my bad, i got mobile terminal working. for the other noobs like me:
    type “login root” then use “alpine” as password before using the chown command
    YAY mail!!!

  7. I am a Noob with no competence in terminal, unfortunately they do not teach Unix at school :/ , so i was wondering if yu could provide a line by line direction of what i need to type into mobile terminal? i’m sure that some may say that youhave provided adiquet directions in this post but I do not understand it. It would be a grate help if you could do very basic directions for what i need to typ in and what should come up n mobile terminal.

    Thank you so much and i am glad i am not the only one with this issue.

  8. thanks for the details,
    but i seem to have a problem. im using mobile terminal on 2.0 firmware and
    i get this error when i use chown -R
    chown :changing ownership of ‘var/mobile/Library/Mail/Account.plist’ : operation not permitted
    chown :changing ownership of ‘var/mobile/Library/Mail’ : operation not permitted

    do you know why i cant change the owner ?

  9. Ah yeah I realise now that mobile terminal logs you in as “mobile”. You
    need to type “su” then enter the root password “alpine” to elevate yourself
    to root before typing the commands.

  10. Wish I’d found this and the jailbreak before I lost my iPhone! About to go get a 3G one, I’m on the beta for iRedHanded, so hopefully next time I will be able to see the thief on the map and go bust em! 🙂 I wish we didn’t have to fiddle with our phones just to get them to do what they should do too!

  11. guys, i have a slightly diferent problem witm … whenever i wish to send new email it doesnt do anything, no network activity, nothing, just the bar at trhe bottow, saying “sending” but its not “growing” :/ do you have any idea how to resolve this one????

  12. Thank you Ben worked like a charm. Does beg the question should we be changing the root password (or indeed the mobile one) to something else, and if so.. how?

  13. Hi Martin
    I had Mail running but stuck on “Checking for Mail” forever, Ben’s fix resolved the issue.

  14. I would think the unix passwd command would work for changing the password, but I don’t know what it would break. You can always uninstall OpenSSH and Mobile Terminal if you are paranoid about remote access.

  15. Hey

    I was not able to access my iPhone from the Laptop (port 22: Connection refused). But with the Terminal on my iPhone it worked.

  16. Ben Firstly, i never have the patience to comment, post on forums etc etc, kinda selfish I know. But I had to post here to thank you.
    So what did I mostly use my iPhone for? Mails… But a restore rendered that app useless. I thought the cause was the brilliant app Bossprefs, but just today i came across ur post. Did what you wrote and voila, MY MAIL APP IS WORKING. Thanks a LOT man!!!!

    P.S. Beng has posted a way to use “mobile terminal” to use your method. That was NECESSARY for me because I dont have wifi so thanks to Beng too.

  17. thanks alot.. finaly got it to work when i found out u had to use the capital letters… 🙂

  18. Excellent stuff! I thought it was probably a permissions problem, but didn’t know where.

    I believe it explains my current inability to save photos to my Camera Roll. I worked around that one by using SwapCameraRoll, but that isn’t fully satisfying as I want to know where that stuff is in the filesystem!

    Thanks for your help with this one!

  19. Thank you very much! I’ve managed to do it in the mobile using mobile to read the commands.
    Yeah, awesome, thanks again. Btw, they don’t really teach Unix in Czech Republic;)

  20. Hex ho!

    Thx for this fantastic post from germany. Im sitting at the airport after updating to 2.0, wanting to check my mails and was quite frustrated, since im Going to Mexico without a laptop.

    You saved my day!



  21. Cheers dude 🙂 fixed it! anyone who has problems with installing openssh (like me) the servers seem to be very slow and down a lot of times, so i couldnt download it for some time. had to try 20 times…

  22. One more tip: Download Bossprefs and go on: “More” – then click on “Fix User Dir Permissions” – that should do the trick as well without using the terminal! My mail did work after the terminal fix but it didnt show any messages, so i did this and voila it works now…

    Have fun…

  23. I used bossprefs too but without this post I never would have known to do so. Thanks and woo-boo as ordered!

  24. Good one. Do you have a link that I can add to the article? Perhaps with “If you want a Czech version then click here” in Czech?

  25. Ben,

    ANy fixes for outgoing mail issue on pwned 2.0 with an exchange account using activesync.

    I am unable to send mails using my home wifi. Can do so with EDGE or office wifi!!

    Any help or direction would be greatly appreciated


  26. That sounds a lot like a firewall issue. Definitely not a permissions
    issue. Surprising that it works over EDGE though. Sure you don’t have any
    outbound firewalling going on with your home network?

  27. I love you! I have tried basically everything: restore 2.0.2, jailbreak, un-jailbreak, 2.0.1, jailbreak, pray, curse… This has fixed it!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.