Some permission related issue on macOS.
File lock issue#
For some time, when I open kitty terminal on macOS, I always see the following warning message:
zsh: locking failed for /Users/jdhao/.histfile: operation not permitted: reading anyway
This may be because the HOME directory is locked (for me, this is the case).
To unlock the directory, open the Finder and click the $HOME directory, press
Command + i to get the file info. Under the General
section, make sure that the Locked button is unchecked.
To change the file lock state on the command line, use chflag:
chflag -R nouchg /path/to/directory
After restarting the terminal emulator, the issue should be gone.
Operation permission issue#
Another issue I often get is that when I use ls or rm on some files, I
often get a message like the following:
ls ~/Library/Messages ls: Messages: Operation not permitted
This is due to the disk access issue. Open macOS Security & Privacy settings
and go to Privacy tab. Give your terminal emulator Full Disk Access.
Restart your terminal and the issue will be fixed.