Question about unix code in Terminal

I am making a music player using a Raspberry Pi 2 and RuneAudio software. On their website I downloaded instructions that provided a script for Terminal that I have to modify slightly to accommodate my files. I have tried their forum but no-one has replied. I have tried other sources with out success. Here is my question.


The instructions said to download a file and unzip it then format a micro SD card and use the unix script:

dd bs=1m if=[source] of=[destination]

and an example as:

dd bs=1m if=/Users/antonypa/Desktop/RuneAudio_rpi_0.3-beta_20141029_2GB.img of=/dev/disk2


I assume that in unix script line “dd bs=1m if=/Users/antonypa/Desktop/RuneAudio_rpi_0.3-beta_20141029_2GB.img of=/dev/disk2”  "/Users/antonypa/Desktop/RuneAudio_rpi_0.3-beta_20141029_2GB.img" is the file path for the unzipped file and “antonypa” is the user and I should substitute my user name for it. 


I also assume that “RuneAudio_rpi_0.3-beta_20141029_2GB.img” is the name of a downloaded file and I should substitute the name of the file I downloaded. 


A assume that in the destination /dev/disk2 is a path for the micro card and that disk2 is the name for the micro card.


My problem is that I don't understand the /dev.


My computer is a M1 Mac Mini 13.4.

Mac mini (M1, 2020)

Posted on Jun 14, 2023 10:25 AM

Reply
Question marked as Top-ranking reply

Posted on Jun 14, 2023 11:01 AM

You first need to get the drive identifier for the microSD card because the drive identifier can change each time the card (or any drive) is mounted. To keep things simple make sure to disconnect all other external drives (or anything which may act like a drive, including any mounted .dmg files, or even .sparsebundles) to minimize confusion. You can use Disk Utility to get the drive identifier for the microSD card once the card has been connected.


Once you have the drive identifier for the microSD card, then you will need to use Disk Utility to unmount the volume (or volumes) on that microSD card. You do not want to "eject" the volume or it will also eject the entire microSD card so that the microSD will not be seen by macOS until you physically remove it and reconnect the card.


Now open a Terminal window and type "sudo dd bs=1m if=". Then using the Finder, drag & drop the .img file you want to use onto the Terminal window so it will auto fill the correct path to the .img file. Then making sure at least one space follows the path, type "of=/dev/diskX", where you will replace the "diskX" with the correct drive identifier for the microSD card. So the final command will look something like this:

sudo  dd  bs=1m  if=/Users/hwtech/Downloads/RuneAudio_rpi_0.3-beta_20141029_2GB.img   of=/dev/diskX


Of course "hwtech" is what would appear as the name of my macOS home folder as that is my macOS user login name. I'm using the name of the .img file you listed, but it is best to do the auto fill by dragging & dropping the .img file onto the Terminal window.


If the drive identifier for the microSD card is "disk4", then the command would be:

sudo  dd  bs=1m  if=/Users/hwtech/Downloads/RuneAudio_rpi_0.3-beta_20141029_2GB.img   of=/dev/disk4


Keep in mind this will destroy all existing data on the microSD card.


You will be prompted for your admin password, but nothing will appear on the screen while typing the password. Just press the "Return" key to submit the password.


Make sure to use the proper drive identifier for the microSD card. If you use the wrong one it may destroy data on whatever drive or volume you give it (shouldn't if it is mounted, but you never know).

4 replies
Question marked as Top-ranking reply

Jun 14, 2023 11:01 AM in response to Bob1177

You first need to get the drive identifier for the microSD card because the drive identifier can change each time the card (or any drive) is mounted. To keep things simple make sure to disconnect all other external drives (or anything which may act like a drive, including any mounted .dmg files, or even .sparsebundles) to minimize confusion. You can use Disk Utility to get the drive identifier for the microSD card once the card has been connected.


Once you have the drive identifier for the microSD card, then you will need to use Disk Utility to unmount the volume (or volumes) on that microSD card. You do not want to "eject" the volume or it will also eject the entire microSD card so that the microSD will not be seen by macOS until you physically remove it and reconnect the card.


Now open a Terminal window and type "sudo dd bs=1m if=". Then using the Finder, drag & drop the .img file you want to use onto the Terminal window so it will auto fill the correct path to the .img file. Then making sure at least one space follows the path, type "of=/dev/diskX", where you will replace the "diskX" with the correct drive identifier for the microSD card. So the final command will look something like this:

sudo  dd  bs=1m  if=/Users/hwtech/Downloads/RuneAudio_rpi_0.3-beta_20141029_2GB.img   of=/dev/diskX


Of course "hwtech" is what would appear as the name of my macOS home folder as that is my macOS user login name. I'm using the name of the .img file you listed, but it is best to do the auto fill by dragging & dropping the .img file onto the Terminal window.


If the drive identifier for the microSD card is "disk4", then the command would be:

sudo  dd  bs=1m  if=/Users/hwtech/Downloads/RuneAudio_rpi_0.3-beta_20141029_2GB.img   of=/dev/disk4


Keep in mind this will destroy all existing data on the microSD card.


You will be prompted for your admin password, but nothing will appear on the screen while typing the password. Just press the "Return" key to submit the password.


Make sure to use the proper drive identifier for the microSD card. If you use the wrong one it may destroy data on whatever drive or volume you give it (shouldn't if it is mounted, but you never know).

Jun 14, 2023 11:01 AM in response to Bob1177

Bob1177 wrote:

I am making a music player using a Raspberry Pi 2 and RuneAudio software. On their website I downloaded instructions that provided a script for Terminal that I have to modify slightly to accommodate my files. I have tried their forum but no-one has replied. I have tried other sources with out success. Here is my question.

The instructions said to download a file and unzip it then format a micro SD card and use the unix script:
dd bs=1m if=[source] of=[destination]
and an example as:
dd bs=1m if=/Users/antonypa/Desktop/RuneAudio_rpi_0.3-beta_20141029_2GB.img of=/dev/disk2

I assume that in unix script line “dd bs=1m if=/Users/antonypa/Desktop/RuneAudio_rpi_0.3-beta_20141029_2GB.img of=/dev/disk2”  "/Users/antonypa/Desktop/RuneAudio_rpi_0.3-beta_20141029_2GB.img" is the file path for the unzipped file and “antonypa” is the user and I should substitute my user name for it. 

I also assume that “RuneAudio_rpi_0.3-beta_20141029_2GB.img” is the name of a downloaded file and I should substitute the name of the file I downloaded. 

A assume that in the destination /dev/disk2 is a path for the micro card and that disk2 is the name for the micro card.

My problem is that I don't understand the /dev.

My computer is a M1 Mac Mini 13.4.


In Ventura —I would verify you have added the Terminal.app to >System Settings>Privacy&Security>Full DIsk Access to avoid issues...





/dev is device reference


re: your /dev/disk2 —You can see your complete list from Terminal copy & paste:

mount



the numbering system is relative not absolute

dev/disk2 is the destination you specified. If you have no /disk2 then you get an error.



From the man page in Terminal copy & paste:

man dd | more


man hdiutil | more

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Question about unix code in Terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.