MacOS – Operation not permitted “sudo ditto -v to folder /usr/bin”

macospermissionsudoterminal

I'm trying to copy an exec file from my downloads folder to /usr/bin/ using sudo ditto -v sweep /usr/bin/sweep, but the command always fails in Terminal. I even tried to manually drag and drop it but the folder only has permissions for the system account. Is there a way I can change my command to allow permissions to this folder so that I can copy the file?.

I'm using OS X 10.11.1

Best Answer

The folder /usr/bin/ is (like other system folders in El Capitan) protected by SIP (System Integrity Protection).

You may either boot to Recovery Mode, disable System Integrity Protection with csrutil disable entered in Terminal.app and after rebooting copy the executable or use the folder /usr/local/bin instead. You may have to adjust your path in the latter case.