macosdmghfs

Need command line tools to extract binaries from dmg file on OSX


I am trying to extract certain files from the following dmg:

https://kakadusoftware.com/wp-content/uploads/2014/06/KDU802_Demo_Apps_for_MacOS_200113.dmg_.zip

I used to be able to extract older versions ${OLD_BINARY} of this dmg using HFSExplorer and the following steps:

  1. Extract HFSExplorer
wget -q http://downloads.sourceforge.net/project/catacombae/HFSExplorer/0.23/hfsexplorer-0.23-bin.zip
mkdir hfsexplorer && cmake -E chdir hfsexplorer tar -xzf ../hfsexplorer-0.23-bin.zip
  1. Extract pkg from dmg
./hfsexplorer/bin/unhfs.sh -o ./ -fsroot OLD_BINARY.pkg  OLD_BINARY.dmg
pkgutil --expand OLD_BINARY.pkg ./kdu
cd kdu
cat libkduv7ar.pkg/Payload | gzip -d | cpio -id
cat kduexpand.pkg/Payload | gzip -d | cpio -id
cat kducompress.pkg/Payload | gzip -d | cpio -id
install_name_tool -id ${PWD}/libkdu_v7AR.dylib libkdu_v7AR.dylib 
install_name_tool -change /usr/local/lib/libkdu_v7AR.dylib ${PWD}/libkdu_v7AR.dylib kdu_compress
install_name_tool -change /usr/local/lib/libkdu_v7AR.dylib ${PWD}/libkdu_v7AR.dylib kdu_expand

But HFSExplorer now fails on this new binary.

So, I am looking for other command line tools to extract the dmg.


Solution

  • This can be accomplished by using 7-zip.