Using a SD card in Mac OS X terminal

Since all Macbook Pros, come with a SD card drive, the other day I started to work on a set of automated scripts that would backup all my data in a SD card. This means I had to learn how to read and write data into a SD card using the Mac OS X terminal.

Step #1- When you insert a card into the system, you need to find out what is the system identifier for that particular SD card. So go to the console and type:

diskutil list

And you will get something like:

In my case, the SD card is identified as disk1.

Step #2- In order for you to write anything directly into the SD card, you need to know where it is mounted. Go to the console and type:

mount

And you will get something like:

In my case, the mount point for the SD card is /Volumes/BEAGLE_BONE.

Step #3- To actually copy something into the SD card, just type any unix command considering the mount point for the SD card as a normal directory. For example:

ls > /Volumes/BEAGLE_BONE/tmp.txt

This command will create a new file (tmp.txt) in the SD card with a listing of all files in the current directory.

Step #4- When you are done, make sure to unmount the SD card by typing, something like:

diskutil umountDisk /dev/disk1

One comment on “Using a SD card in Mac OS X terminal

  1. David Sosna on said:

    Didn’t think it was this straight forward! Want to put a 2D array of data for calendar dates (on and off times for electronic devices) onto an Arduino to run a lab experiment for 365 days unattended. Putting the data onto an SD card, then onto an SD card reader shield (small mountable board for Arduino), gives the micro controller all the data it needs to run for a year. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>