Pragmatism in the real world

Missing mime-info database for use with File::MimeInfo

A requirement I have on a current project means that I need to determine the mime type of a file I load from disk.

One way to do this is to use the File::MimeInfo::Magic CPAN module like this:

use File::MimeInfo::Magic;
my $mime_type = mimetype($path_to_file);

However, on OS X, an error was raised:

WARNING: You don’t seem to have a mime-info database. The
shared-mime-info package is available from .

The easiest way to solve this is via Homebrew:

$ brew install shared-mime-info
$ update-mime-database /usr/local/share/mime