windowsmacosdmg

Create mac DMG file on windows


We've got application which produces installer for windows and mac (app works under windows). It is almost finished, the last step is to create dmg. Is it possible to do it on windows?


Solution

  • Problem solved. I've used mkisofs to create dmg. This is my gradle script which produces dmg file:

    apply plugin: 'base'
    
    task build << {
        if (!project.hasProperty('dmgBuildDir')) {
            project.ext.set('dmgBuildDir', buildDir.absolutePath)
        }
        def mkisofs = new File(project.projectDir, 'src/main/resources/mkisofs.exe').getAbsolutePath()
        ant.exec(executable:mkisofs, failonerror: false, resultproperty: 'buildDmgRc') {
            arg(value: '-J')
            arg(value: '-R')
            arg(value: '-o')
            arg(value: DmgName+'.dmg')
            arg(value: '-mac-name')
            arg(value: '-V')
            arg(value:  DmgLabel)
            arg(value: '-apple')
            arg(value: '-v')
            arg(value: '-dir-mode')
            arg(value: '777')
            arg(value: '-file-mode')
            arg(value: '777')
            arg(value: new File(buildDir, 'installer'))
        }
        if (!ant.properties['buildDmgRc'].equals('0')) {
            throw new Exception('ant.exec failed rc: '+ant.properties['buildDmgRc'])
        }
    }