"dd: /dev/disk4: Permission denied" error when making LiveUSB on Mac OS X
One common cause for this is a "locked" SD card. Unfortunately it seems that the sensor in the MacBook Pro and Air can get stuck. It can be fixed with a can of compressed air.
A lot of us ran into this trying to image SD cards for the Raspberry Pi. And with that device you have no option but to boot off of the SD.
This raises a fascinating fact. It seems that the lock switch is a purely mechanical "intent indicator" that must be sensed by the host device. This is analogous to the way the lock switch worked on 3.5" floppy drives, so it should be no shock to those of us old enough to have to punch a hole in our 5.25" floppies to make them writeable. (And cover the hole with tape to make them readonly!) However, because it is called Secure Digital and is solid state, you would expect the card to protect itself, not rely on the host.
I came across this once too. Use 'diskutil' to check the device your SD card appears as:
diskutil list
Then unmount it (Don't unmount using 'Finder', it wont work):
diskutil unmountDisk /dev/disk_4
Now use the 'dd' command to load your image:
sudo bash -c 'gzip -dc the_image_file.img.gz | dd of=/dev/disk_4'
I hope this helps.
Since it's silly that sudo (essentially 'root') can't access the device with dd it would seem that the error message "Permission denied" does not actually mean that root has a permissions problem. iow it's a red herring.
Double check that the device is not still mounted - run the unmount command again as per step 7 and double check that it really is unmounted but still accessible as a device.
A common problem I've had with making USB boot devices under linux is an inconsistent partition table. Delete the partition table completely and remake it, then create the new new partition as FAT and format it for good measure. The errors I get under Linux don't make any more sense than this one, so I'm hoping that this is what your problem is.
I'll have a shot at removing the partition table under OSX. Note that I am a linux user, so I'm relying on the fact that OSX is similar, and that the same thing seems to be found for OSX on a google search.
First we'll use dd to erase the partition table on the USB drive. In a terminal type:
sudo dd if=/dev/zero of=/dev/disk4 bs=512 count=1
This should overwrite the first 512 bytes of the device, thus destroying the partition table. Instructions I found here seem to suggest
sudo dd if=/dev/zero of=/dev/disk4 bs=1 count=1024
for OSX however the difference is minor and I believe the end result should be the same. As for any dd operation make sure you have the correct partition as there will be nothing left of the data on the device after you press enter.
Next I believe you should use disk utility to to recreate the partition table, and a new partition, and format it FAT. I'm a linux user, so I'm afraid I can't be more specific but I believe that the disk utility should complain that that there is no partition table and either make one for you, or prompt you to do so.
Use sudo in front of the dd command
sudo dd if=/Users/JPurcell/Downloads/Fedora-18-x86_64-Live-Desktop.iso of=/dev/disk2
WARNING: Improper use of the sudo command could lead to data loss or the deletion of important system files. Please double-check your typing when using sudo. Type "man sudo" for more information.
that fixed the permission denied for me. it seems to be working now.
and I was root before hand. I also did the
sudo dd if=/dev/zero of=/dev/disk4 bs=1 count=1024 before sudo dd if=/Users/JPurcell/Downloads/Fedora-18-x86_64-Live-Desktop.iso of=/dev/disk2
I did it right after without reformatting the usb drive. I dont know if its been successful but lights blinking on the drive and terminal is not giving me errors.