MX (.mx)

Background & Context

    • Wolfram Language serialized package format.
    • Used for the distribution of Wolfram Language packages.
    • Stores arbitrary Wolfram Language expressions in a serialized format optimized for fast loading.
    • Binary file format.
    • MX files cannot be exchanged between operating systems that differ in $SystemWordLength.
    • MX files created by newer versions of the Wolfram System may not be usable by older versions.
    • Developed by Wolfram Research.

Import & Export

  • Import[""] reads in an MX file and returns an expression.
  • Export["",expr] serializes an arbitrary Wolfram Language expression and saves it as an MX file.
  • Import["",elem] imports the specified element from an MX file.
  • The import format can be specified with Import["file","MX"] or Import["file",{"MX",elem,}].
  • Import[""] is equivalent to Get[""].
  • See the following reference pages for full general information:
  • Import, Exportimport from or export to a file
    CloudImport, CloudExportimport from or export to a cloud object
    ImportString, ExportStringimport from or export to a string
    ImportByteArray, ExportByteArrayimport from or export to a byte array

Import Elements

  • General Import elements:
  • "Elements"list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • Import elements:
  • "Expression"reads and evaluates all expressions, returning the last one
    "HeldExpression"list of unevaluated expressions
  • Import by default uses the "Expression" element for Wolfram Language MX files.


Basic Examples  (1)

Export an arbitrary Wolfram Language expression to the MX format:

Show the available Import elements:

Import as an expression: