Find and Export the Modelfile for an Existing Ollama Model

If you created an Ollama model and misplaced the original Modelfile, the CLI can print the installed model's generated recipe. The generated FROM line can point to a local model blob, so inspect it before using the recipe elsewhere.

Worked example

Inspect an existing variant and save its generated recipe

ollama list
ollama show --modelfile release-note-demo > exported.Modelfile
sed -n '1,24p' exported.Modelfile

Steps

  1. Run ollama list and copy the exact name of the installed variant. Use the example export command with its name to save a new recipe.
  2. Read FROM and identify the original base model. If FROM points to an absolute local blob path, replace it with the exact base model tag or a portable local model file that is available on the target computer.
  3. On the target computer, make the same base model available and run ollama create release-note-copy -f exported.Modelfile. Compare SYSTEM, TEMPLATE, and relevant PARAMETER lines with the original recipe.

What to check

  • A failed export can leave an empty file after shell redirection. Check the command status and file contents before transferring it.
  • The recipe describes configuration and references. It does not transfer the model weights. Check licensing and base model identity if you share a variant.

Generate a human-editable Modelfile

References