Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

How can I list all the currently memory devices on MacOS X? I need to do this by command, because I have an Java application that needs this information.

Thanks

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You can use the native OS X diskutil command as shown below:

$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            499.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             654.6 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *8.1 GB     disk1
   1:                 DOS_FAT_32 LACI                    8.1 GB     disk1s1

If you're doing this from the command line the following command would list the Volumes currently mounted and their mount point in the filesystem:

$ df | grep ^\/dev\/disk
/dev/disk0s2                      487542528 377409836 109876692  78% /
/dev/disk1s1                        7879680   1128124   6751556  15% /Volumes/LACI

If you're just interested in the physical disks:

$ df | grep -i ^\/dev\/disk | awk {'print $1'}
/dev/disk0s2
/dev/disk1s1

Or the mount points:

$ df | grep -i ^\/dev\/disk | awk {'print $6'} 
/
/Volumes/LACI
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.