I'm trying to recover a bad sector on my disk, and in doing so, need to write over the bad sector. Numerous sources on the web suggest using dd to do so, but doing so does not work:
$ sudo dd if=/dev/zero of=/dev/disk1 bs=512 count=1 seek=961575240 dd: /dev/disk1: Operation not permitted $
I figured maybe there was some sort of check about doing this to a mounted filesystem, so I booted into single-user mode (which at least leaves is in read-only mode), but I still get the same error. Some additional messages about sandboxing are also displayed however.
Sandbox: dd(5) System Policy: deny(1) file-write-data /dev/disk1 Sandbox: dd(5) System Policy: deny(1) file-write-data /dev/disk1
Is there a way to allow dd out of the sandbox? I tried
sudo sandbox-exec -p '(version 1) (allow default)' /bin/dd if=/dev/zero of=/dev/disk1 bs=512 count=1 seek=961575240
but that still gave the operation not permitted error.
This is on OS X 10.11 GM