tags:

views:

10541

answers:

5

How does one go about creating a virtual CD driver on Mac OS X programatically?

I can't find any relevant Cocoa APIs or any pure C BSD solutions.

Any help or information is appreciated.

+1  A: 

If you're simply looking to mount an ISO or something then it's done through the Disk Utility, simply drag it into the side-bar and then select it and choose mount.

If you want to do it from code you can issue the hdiutil command, as shown here. I'm not sure if there's an API call to do it, but getting that command to do the work is quite painless.

Timothy Walters
+5  A: 

You would need to use the I/O Kit framework to develop your own device driver that would emulate a virtual CD drive. Here are some links to the relevant APIs to get you started.

I/O Kit Fundamentals

I/O Kit Device Driver Guidelines

Kernel Extension Programming Topics

Brian Webster
A: 

The simplest way to mount a custom volume is MacFUSE. It handles the IOKit details for you and lets you write the implementation in user space. However, I don’t think you can make a MacFUSE “look like” a CD; you’d have to modify FUSE to achieve that.

Ahruman
+2  A: 

There are several different answers people have proposed here. The issue at hand is what are you trying to accomplish. If you really want to emulate a CD ROM (down to the commandset) you will need to write a device driver. If your goal is merely to emulate a block device with contents similiar to a CD you can create a disk image using disk utility and let the builtin disk image driver handle it for you.

MacFUSE is useful if you want to present some sort of custom filesystem functionality, but if what you are looking for is something that has the same semantics as an optical disc (whether that is and block or command set level) it is the wrong tool.

Louis Gerbarg
A: 

Use our Virtual CD-RW Driver: http://www.burningthumb.com/virtualcdrw.html

A. Wiebe