dmg The .dmg extension file is a disk image file, formatted by Apple Macintosh OS X. These files are usually used to install programs on computers having Mac OS. These files cannot be opened easily on Windows Operating Systems as they are intended for use on Macintosh Operating Systems.
tgz The .gz filename extension refers to the GZIP file format and compression/decompression utility of the same name which was initially released in 1992. It is the extension given to files compressed using the gzip utility. Unlike other compression tools of the time, gzip was originally intended to be used as a tool to compress a single file as opposed to multiple files or entire directories compressed as a single archive. As a work around, multiple files can be archived using the TAR archive file format, then that single TAR archive would then be compressed using the GZIP format. This would give the file a filename extension of .tar.gz.