libmagic
« Back to VersTracker
Description:
Implementation of the file(1) command
Type: Formula  |  Tracked Since: Dec 28, 2025
Links: Homepage  |  formulae.brew.sh
Category: System utilities
Tags: file-type-detection mime-types c-library utilities file-analysis
Install: brew install libmagic
About:
Libmagic is the core library behind the ubiquitous Unix `file` command, designed to identify file types by examining their contents rather than relying on file extensions. It utilizes a sophisticated database of magic numbers and patterns to accurately determine MIME types and file formats. This package provides the essential runtime components for applications requiring robust file type detection capabilities.
Key Features:
  • Identifies file types using magic numbers and file structure analysis
  • Provides detailed MIME type detection capabilities
  • Extensible magic database that can be customized
  • C library API for integration into other applications
  • Powers the standard Unix `file` command
Use Cases:
  • Building file upload validators that verify actual file content
  • Implementing asset management systems that need automatic file categorization
  • Developing security tools for analyzing unknown files
  • Creating cross-platform file analysis utilities
Alternatives:
  • TrID – Windows-focused alternative with binary definition files, less Unix-integrated
  • file command (BSD/GNU) – The command-line tool that uses libmagic; libmagic is the library version
Version History
Detected Version Rev Change Commit