This page is a wiki. Please login or create an account to begin editing.

1 post / 0 new
uyjulian's picture
Joined: 2013 Jul 13
Managing various archive/image formats on macOS using the Terminal

There are ways to convert between various archive and image formats on macOS using the Terminal.

"The Unarchiver" supports Stuffit (.sit), Stuffit X (.sitx), MacBinary, BinHex, along with many other archive formats, and it has a command line tool:

To use it:
unar file.sit

It also extracts resource forks and Finder Info, so you don't lose any information.
You can use the following command to check resource fork and Finder Info information:
ls -@l /path/to/file/or/folder

Check for the presence of "" and "" attributes.

You can create .tar.gz files with extra attributes (including resource forks and Finder Info) using this command:
tar -czf /path/to/archive.tar.gz /path/to/file/or/folder

You can convert into MacBinary II using macbinary tool:
macbinary -t 2 encode -o /path/to/macbinary.bin /path/to/file

You can convert NDIF, DiskCopy 4.2, Toast disk images, macOS DMG images, etc:
hdiutil convert -format UDxx -o /path/to/output/image.img /path/to/input/image.dmg
The format UDxx will work with emulators, but there are many other formats you can convert to.
hdiutil convert -help
for a listing of the formats you can convert to.
This tool won't work with DiskSet formats such as the ones used in the Mac OS 7.5.3 install sets (.smi/.part). You need to use Disk Copy 6.3.3 in an emulator to mount the image, then create an image from the mounted image.

You can "bless" a System Folder using the bless command line tool:
sudo bless -folder9 /path/to/System/Folder

You can also set a label that will appear in the menu when you hold down option while booting:
sudo bless -folder9 /path/to/System/Folder -label "Your Label"

You can run these commands in batch if you combine it with the find command. For example:
find . -name \*.sit -exec unar {} \;
will extract all Stuffit archives in the current directory.
find . -name \*.img -exec hdiutil convert -format UDxx -o {}.dmg {} \;
will convert all disk image files ending in .img to a format usable in emulators.