Saturday, March 29, 2014

Mac OS X file versus Mac Ports file

So recently, I started having an issue - the default "file" command on my Mac OS machine didn't identify any file, but returned an error message instead.

Trying the native Mac OS version worked, but the one installed by MacPorts (/opt/local/bin/file) would just report a regex error.




$ /usr/bin/file magicmagic: magic text file for file(1) cmd$ /opt/local/bin/file magicmagic: ERROR: line 19439: regex error 17, (illegal byte sequence)

A closer look at the magic file that lives in /opt/local/share/misc/ revealed that line 19439 is

0       regex/s         \\`(\r\n|;|[[]|\xFF\xFE)

Disabling the line with a "#" and recompiling the magic file with the "-C -m <magic file>" solved the issue.