MacOS – Is it impossible to delete/move a file named “␀” on mac

command linefindermacos

When I try to move, rename, or delete a file named in Finder, I get this error message:

The operation can't be completed, because an unexpected error occured (error code -50).

With mv, rm or find -delete in Terminal

 rm: /Library/␀: Invalid argument
 mv: rename /Library/␀ to /tmp/␀: Invalid argument
 find: -delete: unlink(/Library/␀): Invalid argument

Can I move or delete this file in Mac OS X or do I have to use another operating system?

I even tried creating a file with this name in /tmp and it has not gone away since 8 reboots.

Best Answer

You can attempt to remove the file by its inode number. List the files in /Library with the -i option

ls -il /Library

The first column is the inode number of the file. Then use find

find /Library -inum XXXXXXX -delete

where XXXXXX is the inode number of the file.