'mitmproxy transparent mode OSX permission denied

I want to run mitmproxy on osx 12.1 in transparent mode on the same device as the client I want to capture traffic from. I followed the instructions from the docs but get Permission denied: '/Users/lyinch/.mitmproxy/command_history' and Permission denied: '/Users/lyinch/.mitmproxy/mitmproxy-ca.pem' in the event log.

I launch the application with sudo -u nobody mitmproxy --mode transparent --showhost and the permissions on these files are as follows:

% ls -al ~/.mitmproxy 
total 48
drwxr-xr-x   8 lyinch  staff   256 Jan 28 13:22 .
drwxr-x---+ 49 lyinch  staff  1568 Jan 28 14:12 ..
-rw-r--r--   1 lyinch  staff  1172 Jan 28 13:22 mitmproxy-ca-cert.cer
-rw-r--r--   1 lyinch  staff  1015 Jan 28 13:22 mitmproxy-ca-cert.p12
-rw-r--r--   1 lyinch  staff  1172 Jan 28 13:22 mitmproxy-ca-cert.pem
-rw-------   1 lyinch  staff  2390 Jan 28 13:22 mitmproxy-ca.p12
-rw-------   1 lyinch  staff  2847 Jan 28 13:22 mitmproxy-ca.pem
-rw-r--r--   1 lyinch  staff   770 Jan 28 13:22 mitmproxy-dhparam.pem

I then did chmod 604 ~/.mitmproxy/mitmproxy-ca.pem to give read access to other : -rw----r-- 1 lyinch staff 2.8K Jan 28 13:22 mitmproxy-ca.pem. Unfortunately I still get the same permission denied error.

Which permissions should I set for this to work?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source