[GH-ISSUE #2633] How to update all models #27316

Closed
opened 2026-04-22 04:33:19 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @meminens on GitHub (Feb 21, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2633

Do I have tun run ollama pull <model name> for each model downloaded? Is there a more automatic way to update all models at once?

Originally created by @meminens on GitHub (Feb 21, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2633 Do I have tun run `ollama pull <model name>` for each model downloaded? Is there a more automatic way to update all models at once?
GiteaMirror added the question label 2026-04-22 04:33:19 -05:00
Author
Owner

@seanmavley commented on GitHub (Feb 21, 2024):

That'll be a nice feature, but as it stands now, shouldn't be hard to do yourself with a single command like below

ollama list | awk 'NR>1 {print $1}' | xargs -I {} sh -c 'echo "Updating model: {}"; ollama pull {}; echo "--"' && echo "All models updated."
<!-- gh-comment-id:1957315877 --> @seanmavley commented on GitHub (Feb 21, 2024): That'll be a nice feature, but as it stands now, shouldn't be hard to do yourself with a single command like below ``` ollama list | awk 'NR>1 {print $1}' | xargs -I {} sh -c 'echo "Updating model: {}"; ollama pull {}; echo "--"' && echo "All models updated." ```
Author
Owner

@Natfan commented on GitHub (Feb 21, 2024):

Here's a little PowerShell one-liner to do the same thing, if you're on Windows or have it installed on your OS. Note that you may need to update the URI if you're hosting on a different port/server (I personally am using an NGINX reverse proxy)

(Invoke-RestMethod http://localhost:11434/api/tags).Models.Name.ForEach{ ollama pull $_ }

To perform a dry-run of the command, simply add quotes around "ollama pull $_" to print the command to the terminal instead of executing it. You could also use ForEach-Object -Parallel if you're feeling adventurous :)

<!-- gh-comment-id:1957954776 --> @Natfan commented on GitHub (Feb 21, 2024): Here's a little PowerShell one-liner to do the same thing, if you're on Windows or have it [installed on your OS](https://learn.microsoft.com/powershell/scripting/install/installing-powershell). Note that you may need to update the URI if you're hosting on a different port/server (I personally am using an NGINX reverse proxy) ```ps (Invoke-RestMethod http://localhost:11434/api/tags).Models.Name.ForEach{ ollama pull $_ } ``` To perform a dry-run of the command, simply add quotes around "ollama pull $_" to print the command to the terminal instead of executing it. You could also use [`ForEach-Object -Parallel`](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/foreach-object#example-11-run-slow-script-in-parallel-batches) if you're feeling adventurous :)
Author
Owner

@hoyyeva commented on GitHub (Mar 11, 2024):

Hi @misaligar, it looks like this issue is quite similar to what's been reported in #2586. We understand the current workaround isn't ideal, but please know we're actively seeking a more effective solution. We'll keep the community updated as soon as we make progress that improves the situation. For now, I'll close this issue, but we're aware of this issue and working to resolve this.

<!-- gh-comment-id:1989475117 --> @hoyyeva commented on GitHub (Mar 11, 2024): Hi @misaligar, it looks like this issue is quite similar to what's been reported in #2586. We understand the current workaround isn't ideal, but please know we're actively seeking a more effective solution. We'll keep the community updated as soon as we make progress that improves the situation. For now, I'll close this issue, but we're aware of this issue and working to resolve this.
Author
Owner

@TadayukiOkada commented on GitHub (Apr 26, 2024):

hope this will be merged soon:
https://github.com/ollama/ollama/pull/2179

<!-- gh-comment-id:2079417990 --> @TadayukiOkada commented on GitHub (Apr 26, 2024): hope this will be merged soon: https://github.com/ollama/ollama/pull/2179
Author
Owner

@sammcj commented on GitHub (May 5, 2024):

I have a little zsh alias that adds this functionality you might find useful:

# wrap the ollama command, if the parameter is pull with no other parameters pull all models
function ollama() {
  if [[ $1 == "pull" ]] && [[ $# -eq 1 ]]; then
    echo "pulling all models..."
    ollama list | awk '$1 !~ /^registry.local/ {print $1}' | while read -r model; do
      echo "Pulling $model"
      ollama pull "$model"
    done
  else
    command ollama "$@"
  fi
}
<!-- gh-comment-id:2094529802 --> @sammcj commented on GitHub (May 5, 2024): I have a little zsh alias that adds this functionality you might find useful: ```bash # wrap the ollama command, if the parameter is pull with no other parameters pull all models function ollama() { if [[ $1 == "pull" ]] && [[ $# -eq 1 ]]; then echo "pulling all models..." ollama list | awk '$1 !~ /^registry.local/ {print $1}' | while read -r model; do echo "Pulling $model" ollama pull "$model" done else command ollama "$@" fi } ```
Author
Owner

@cycleuser commented on GitHub (Sep 22, 2024):

On Windows, PowerShell users can use this:

$models = ollama list | Select-Object -Skip 1 | ForEach-Object { $_.Split()[0] }
foreach ($model in $models) {
    Write-Output "Updating model: $model"
    ollama pull $model
    Write-Output "--"
}
Write-Output "All models updated."
<!-- gh-comment-id:2366724378 --> @cycleuser commented on GitHub (Sep 22, 2024): On Windows, PowerShell users can use this: ```PowerShell $models = ollama list | Select-Object -Skip 1 | ForEach-Object { $_.Split()[0] } foreach ($model in $models) { Write-Output "Updating model: $model" ollama pull $model Write-Output "--" } Write-Output "All models updated." ```
Author
Owner

@meminens commented on GitHub (Sep 22, 2024):

On Windows, PowerShell users can use this:

$models = ollama list | Select-Object -Skip 1 | ForEach-Object { $_.Split()[0] }
foreach ($model in $models) {
    Write-Output "Updating model: $model"
    ollama pull $model
    Write-Output "--"
}
Write-Output "All models updated."

Thank you! That didn't work for me and I came up with the following:

function updateModels {
    $models = ollama list | Select-Object -Skip 1 | ForEach-Object {
        if ($_ -notmatch '^NAME\s+') {
            if ($_ -match '(\S+)\s+') {
                $Matches[1]
            }
        }
    }

    if ($models.Count -eq 0) {
        Write-Output "No models found to update."
        return
    }

    foreach ($model in $models) {
        Write-Output "Updating model: $model"
        ollama pull $model
        Write-Output "--"
    }
    Write-Output "All models updated."
}
<!-- gh-comment-id:2366829633 --> @meminens commented on GitHub (Sep 22, 2024): > On Windows, PowerShell users can use this: > > ```powershell > $models = ollama list | Select-Object -Skip 1 | ForEach-Object { $_.Split()[0] } > foreach ($model in $models) { > Write-Output "Updating model: $model" > ollama pull $model > Write-Output "--" > } > Write-Output "All models updated." > ``` Thank you! That didn't work for me and I came up with the following: ```powershell function updateModels { $models = ollama list | Select-Object -Skip 1 | ForEach-Object { if ($_ -notmatch '^NAME\s+') { if ($_ -match '(\S+)\s+') { $Matches[1] } } } if ($models.Count -eq 0) { Write-Output "No models found to update." return } foreach ($model in $models) { Write-Output "Updating model: $model" ollama pull $model Write-Output "--" } Write-Output "All models updated." } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#27316