Catalina: rm command don't work

Hello,

With Catalina, the rm command don’t work anymore from the Script Editor application or from my application (signed and notarised or not). It perfectly works in Mojave.

Message: Operation not permitted :rolleyes:

Full Disk Access is permitted in the System Preferences.

Do you know why?

Thanks a lot.

It works in test here. It sounds like the issue is with what you’re trying to delete rather than the command itself.

Thanks Shane but I don’t think… Delete the content of the trash, for example or delete a simply file or folder in the Documents folder recently created.Perhaps a problem with my system (Clean Install)

The Trash is a protected directory, as is Desktop. I’m not sure about Documents. having said that, my successful test was a file on the Desktop.

This is because from macOS Catalina system files are in another partition
which is read only, called DATA to access this partition you first need to mount it with
the following command:

do shell script "mount -uw /" with administrator privileges

after this the RM command will work.

Thanks but…

error “mount_apfs: volume could not be mounted: Operation not permitted
mount: / failed with 77” number 77

With the Beta of Catalina, there was a Data partition visible everywhere, but in the Finale version, the Data partition is only visible in the Disk Utility.

Please post a part of your code.

Hi,

In the Script Editor (or from Xcode):

do shell script "rm -rf /Users/myaccount/.Trash/*" with administrator privileges[/AppleScript]

or


do shell script “rm -rf ~/.Trash/*” with administrator privileges
[/AppleScript]

From the Terminal, these commands perfectly work.

try:

do shell script "mount -uw /;killall Finder" with administrator privileges
do shell script "rm -rf ~/.Trash/" with administrator privileges

Operation not permitted

I did a test on a fresh install macOS Catlina, and everything works as expected.
The problem may be with your macOS Catalina installation.

Thanks TheIaMonLyOneHeRe!

Very strange. Clean Install of Catalina.
The command rm without the administrator privileges perfectly works.

do shell script "rm -rf ~/.Trash/"

Good news, enjoy!