Locked file is stuck in trash I have a file in my Trash.  The filename is 'codedesign' and it is a Unix executable file.  This file ended up there in the process of me trying to fix a corrupted patch installer.  The original version is still in my /usr/bin/ directory and therefore this one would be fine to delete.

The situation looks like this, the file is the only thing that is in my Trash.  When I click empty trash it doesn't show an error message, but it doesn't delete the file.
When I right click the file and select 'Delete Immediately...'  it asks me for my password then comes up with the error message 'The operation can’t be completed because you don’t have permission to access some of the items.'

The file permissions say that my user has 'Read &amp; Write' while the Wheel user has 'Read'.  I can't change any permissions without getting an error message saying that I don't have permission to make changes.

I can't put the file back as this option isn't available when I right click.  When I try and drag the file out of the trash it simply makes a copy.

I've tried using the app Trash It! as well as CleanMyMac3 But these do nothing.

The results of the following terminal commands used so far:

$ sudo rm -rf ~/.Trash/*
rm: /Users/JamieMacLeod/.Trash/codesign: Operation not permitted
$ ls -ald ~/.Trash/* 
-rwxr-x--x@ 1 JamieMacLeod wheel 86032 31 Oct 2014 /Users/JamieMacLeod/.Trash/codesign
$ xattr -l /Users/JamieMacLeod/.Trash/codesign
com.apple.metadata:kMDItemWhereFroms:
00000000  62 70 6C 69 73 74 30 30 A2 01 02 5F 10 62 68 74  |bplist00..._.bht|
00000010  74 70 3A 2F 2F 64 63 36 35 33 2E 34 73 68 61 72  |tp://dc653.4shar|
00000020  65 64 2E 63 6F 6D 2F 64 6F 77 6E 6C 6F 61 64 2F  |ed.com/download/|
00000030  6A 4C 69 4C 4F 68 38 54 63 65 2F 63 6F 64 65 73  |jLiLOh8Tce/codes|
00000040  69 67 6E 2E 68 74 6D 6C 3F 74 73 69 64 3D 32 30  |ign.html?tsid=20|
00000050  31 34 31 30 33 31 2D 30 32 34 34 33 33 2D 34 32  |141031-024433-42|
00000060  62 64 39 64 63 64 26 6C 67 66 70 3D 32 30 30 30  |bd9dcd&amp;lgfp=2000|
00000070  5F 10 33 68 74 74 70 3A 2F 2F 77 77 77 2E 34 73  |_.3http://www.4s|
00000080  68 61 72 65 64 2E 63 6F 6D 2F 67 65 74 2F 6A 4C  |hared.com/get/jL|
00000090  69 4C 4F 68 38 54 63 65 2F 63 6F 64 65 73 69 67  |iLOh8Tce/codesig|
000000A0  6E 2E 68 74 6D 6C 08 0B 70 00 00 00 00 00 00 01  |n.html..p.......|
000000B0  01 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00  |................|
000000C0  00 00 00 00 00 00 00 00 A6                       |.........|
000000c9
com.apple.quarantine: 0001;5543f6cd;Google\x20Chrome;0F73411A-982E-4A8A-B099-93610324B751

$ ls -lO@ /Users/JamieMacLeod/.Trash/codesign
-rwxr-x--x@ 1 JamieMacLeod  wheel  restricted 86032 31 Oct  2014 /Users/JamieMacLeod/.Trash/codesign
com.apple.metadata:kMDItemWhereFroms      201 
com.apple.quarantine       67 


I'm really not sure what to do that this point, surely there is a way to delete one file?  I am the only user on this computer and therefore should have full admin rights.

Any help with this would be very much appreciated.
The group is showing as restricted - this may indicate that it's due to SIP.

Try: https://stackoverflow.com/questions/30768087/restricted-folder-files-in-os-x-el-capitan tells you how to temporarily disable SIP to delete the file.

Could also try sudo chown [owner]:[group]? (Although if it is SIP, I don't think that it's this easy to get around).