DumpSave["file.mx",symbol]
writes definitions associated with a symbol to a file in internal Wolfram System format.
DumpSave["file.mx","context`"]
writes out definitions associated with all symbols in the specified context.
DumpSave["file.mx",{object1,object2,…}]
writes out definitions for several symbols or contexts.
DumpSave["package`",objects]
chooses the name of the output file based on the computer system used.
DumpSave
DumpSave["file.mx",symbol]
writes definitions associated with a symbol to a file in internal Wolfram System format.
DumpSave["file.mx","context`"]
writes out definitions associated with all symbols in the specified context.
DumpSave["file.mx",{object1,object2,…}]
writes out definitions for several symbols or contexts.
DumpSave["package`",objects]
chooses the name of the output file based on the computer system used.
Details and Options
- DumpSave writes out definitions in a binary format that is optimized for input by the Wolfram Language.
- Each file has a plain text header identifying its type and contents.
- Files written by DumpSave can be read by Get.
- Files written by DumpSave cannot be exchanged between operating systems that differ in $SystemWordLength.
- DumpSave will not preserve open stream and link objects.
- Files written by DumpSave conventionally have names that end with .mx.
- DumpSave works with local objects.
- DumpSave["package`",…] writes a file with a name such as package.mx/(value of $SystemID)/package.mx.
- You can use DumpSave["file","s"] to write out the definition for the value of a symbol s itself.
- You can typically read a dump file when you start the Wolfram System by using the initfile command‐line option.
- DumpSave[File["file.mx"],…] is also supported.
Examples
open all close allBasic Examples (1)
f[x_Real] := x ^ 2 + 1;f[x_ ? NumericQ] := N[x ^ 2 + 1]file = CreateFile[];DumpSave[file, f]Clear[f]Verify the definitions have been removed:
DownValues[f]Restore the definitions for f from the file:
Get[file]The definitions have been restored:
DownValues[f]Scope (3)
Define and use several functions in a context:
local`f[x_] := 2x
local`g[x_] := x^2
local`h[x_] := 2^xComap[{local`f, local`g, local`h}, 10]Set the current working directory to the temporary directory:
SetDirectory[$TemporaryDirectory]Save the definitions for all the functions in the context:
DumpSave["local.mx", "local`"]Clear the definitions for all the functions in the context:
Clear["local`*"]Comap[{local`f, local`g, local`h}, 10]<<"local`"Comap[{local`f, local`g, local`h}, 10]Remove all the functions and reset to the original directory:
Remove["local`*"]
ResetDirectory[];Define and use several functions in two contexts:
l2`f[x_] := 2x
l2`g[x_] := x^2
l2`h[x_] := 2^x
l3`f[x_] := 3x
l3`g[x_] := x^3
l3`h[x_] := 3^xComap[{l2`f, l2`g, l2`h, l3`f, l3`g, l3`h}, 10]Save the definitions for all the functions in the context:
file = CreateFile[];
DumpSave[file, {"l2`", "l3`g"}]Clear all the functions in the contexts:
Clear[RegularExpression["l[23]`.*"]]Comap[{l2`f, l2`g, l2`h, l3`f, l3`g, l3`h}, 10]Get[file]All the functions in the context "l2`" work again, but only g was saved and restored in the context "l3`":
Comap[{l2`f, l2`g, l2`h, l3`f, l3`g, l3`h}, 10]Remove all the functions from the two contexts:
Remove[RegularExpression["l[23]`.*"]]Save definitions to a file specified as a File object:
file = CreateFile[];DumpSave[File[file], f]Properties & Relations (1)
Local objects can be used with DumpSave to save definitions persistently:
f[x_Real] := x ^ 2 + 1;
f[x_ ? NumericQ] := N[x ^ 2 + 1]DumpSave[LocalObject["f"], f]Clear[f]Restore the definitions for f from the local object:
Get[LocalObject["f"]]Definition[f]See Also
BinarySerialize Save LinkWrite Export Put
Function Repository: CompressWithDefinitions Pacletize
Tech Notes
Related Guides
History
Introduced in 1996 (3.0) | Updated in 2014 (10.0) ▪ 2016 (11.0)
Text
Wolfram Research (1996), DumpSave, Wolfram Language function, https://reference.wolfram.com/language/ref/DumpSave.html (updated 2016).
CMS
Wolfram Language. 1996. "DumpSave." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/DumpSave.html.
APA
Wolfram Language. (1996). DumpSave. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DumpSave.html
BibTeX
@misc{reference.wolfram_2026_dumpsave, author="Wolfram Research", title="{DumpSave}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/DumpSave.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_dumpsave, organization={Wolfram Research}, title={DumpSave}, year={2016}, url={https://reference.wolfram.com/language/ref/DumpSave.html}, note=[Accessed: 13-June-2026]}