Create CD-ISO from files or folder on MAC OS X

Sometimes I have to create an CD ISO from files to mount them as CD on a VM. But how should i do this without searching and buying certain tools? Use the terminal!

I found the following piece of code here and wanna share it to you:

 

hdiutil makehybrid -o ~/Desktop/image.iso ~/path/to/folder/to/be/converted -iso -joliet