After upgrading to 10.14, I am unable to access the ~/Library/Mail directory, either as the user or as root.

[~/Library/Mail 14:01:42]$ ls -l
ls: .: Operation not permitted
[~/Library/Mail 14:04:11]$

So that's pretty weird. It happens even if I am root.

No system flags are set on the directory.

So presumably, this is another system integrity or sandboxing thing. Unfortunately, I have code that wants to access the sqlite3 database inside the ~/Library/Mail directory. So how do I grant my software access to my mail?

This seems to be related to the 10.14 privacy protections.

  • How are you trying to access it? it works for me if I cd ~/Library/Mail then ls -l & how are you acquiring 'root' ? – Tetsujin Nov 7 '18 at 19:24
  • Doesn't work for me! Either as the ordinary user or as root. Which OS version are you using? I'm using 10.14.1 – vy32 Nov 7 '18 at 19:29
  • Oh, I access root with sudo bash – vy32 Nov 7 '18 at 19:30
  • Okay, I figured it out. See the answer below. – vy32 Nov 7 '18 at 19:43

Full Disk Access

Add your application or tool to the Full Disk Access list within System Preferences > Security & Privacy.

This is related to the new macOS Privacy Protections in 10.14, aka Mojave.

If you want programs launched from Terminal to be able to access ~/Library/Mail, you will need to add them to the Full Disk Access list (below). I originally added Terminal and still couldn't access the folder. It turns out that I use iTerm2, and not Terminal. That had to be added also.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .