[GH-ISSUE #1890] A way to update all downloaded models #47596

Closed
opened 2026-04-28 04:26:38 -05:00 by GiteaMirror · 16 comments
Owner

Originally created by @Zig1375 on GitHub (Jan 10, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/1890

I'd like to have a way to update all downloaded models.
Right now I have to pull each model separately.

Originally created by @Zig1375 on GitHub (Jan 10, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/1890 I'd like to have a way to update all downloaded models. Right now I have to pull each model separately.
GiteaMirror added the feature request label 2026-04-28 04:26:38 -05:00
Author
Owner

@rgaidot commented on GitHub (Jan 10, 2024):

You can update all models like this:

#!/bin/bash

ollama list | tail -n +2 | awk '{print $1}' | while read -r model; do
  ollama pull $model
done
<!-- gh-comment-id:1885381713 --> @rgaidot commented on GitHub (Jan 10, 2024): You can update all models like this: ```bash #!/bin/bash ollama list | tail -n +2 | awk '{print $1}' | while read -r model; do ollama pull $model done ```
Author
Owner

@pdevine commented on GitHub (Jan 25, 2024):

See #2179

<!-- gh-comment-id:1911136001 --> @pdevine commented on GitHub (Jan 25, 2024): See #2179
Author
Owner

@yarons commented on GitHub (Apr 21, 2024):

Another option (awk variant dependant but should work on most popular awk variants in both mac and Linux):

ollama list | awk -F: 'NR>1 && !/reviewer/ {system("ollama pull "$1)}'

Explanation:
ollama list - lists all the models including the header line and the "reviewer" model (can't be updated).

awk:

  • -F : - set the field separator to ":" (this way we can capture the name of the model without the tag - ollama3:latest).
  • NR > 1 - skip the first (header) line.
  • && - "and" relation between the criteria.
  • !/reviewer/ - filter out the reviewer model.
  • system("ollama pull "$1) - will run a system command: ollama pull <model> where model is line dependant, this should run separately for every $1 (first column separated by ":") found.

To pull with the tag simply remove the -F::

ollama list | awk 'NR>1 && !/reviewer/ {system("ollama pull "$1)}'
<!-- gh-comment-id:2067962574 --> @yarons commented on GitHub (Apr 21, 2024): Another option (`awk` variant dependant but should work on most popular awk variants in both mac and Linux): ``` ollama list | awk -F: 'NR>1 && !/reviewer/ {system("ollama pull "$1)}' ``` Explanation: `ollama list` - lists all the models including the header line and the "reviewer" model (can't be updated). #### `awk`: * `-F :` - set the field separator to ":" (this way we can capture the name of the model without the tag - **ollama3**:latest). * `NR > 1` - skip the first (header) line. * `&&` - "and" relation between the criteria. * `!/reviewer/` - filter out the `reviewer` model. * `system("ollama pull "$1)` - will run a system command: `ollama pull <model>` where model is line dependant, this should run separately for every `$1` (first column separated by ":") found. To pull with the tag simply remove the `-F:`: ``` ollama list | awk 'NR>1 && !/reviewer/ {system("ollama pull "$1)}' ```
Author
Owner

@lorenzo0932 commented on GitHub (May 21, 2024):

Another option (awk variant dependant but should work on most popular awk variants in both mac and Linux):

ollama list | awk -F: 'NR>1 && !/reviewer/ {system("ollama pull "$1)}'

Explanation: ollama list - lists all the models including the header line and the "reviewer" model (can't be updated).

awk:

  • -F : - set the field separator to ":" (this way we can capture the name of the model without the tag - ollama3:latest).
  • NR > 1 - skip the first (header) line.
  • && - "and" relation between the criteria.
  • !/reviewer/ - filter out the reviewer model.
  • system("ollama pull "$1) - will run a system command: ollama pull <model> where model is line dependant, this should run separately for every $1 (first column separated by ":") found.

To pull with the tag simply remove the -F::

ollama list | awk 'NR>1 && !/reviewer/ {system("ollama pull "$1)}'

this don't work with not "default" models. I use models with Q8_0 quantization and this "script" updates only "default" models (usually Q4_0)

<!-- gh-comment-id:2122751994 --> @lorenzo0932 commented on GitHub (May 21, 2024): > Another option (`awk` variant dependant but should work on most popular awk variants in both mac and Linux): > > ``` > ollama list | awk -F: 'NR>1 && !/reviewer/ {system("ollama pull "$1)}' > ``` > > Explanation: `ollama list` - lists all the models including the header line and the "reviewer" model (can't be updated). > > #### `awk`: > * `-F :` - set the field separator to ":" (this way we can capture the name of the model without the tag - **ollama3**:latest). > * `NR > 1` - skip the first (header) line. > * `&&` - "and" relation between the criteria. > * `!/reviewer/` - filter out the `reviewer` model. > * `system("ollama pull "$1)` - will run a system command: `ollama pull <model>` where model is line dependant, this should run separately for every `$1` (first column separated by ":") found. > > To pull with the tag simply remove the `-F:`: > > ``` > ollama list | awk 'NR>1 && !/reviewer/ {system("ollama pull "$1)}' > ``` this don't work with not "default" models. I use models with Q8_0 quantization and this "script" updates only "default" models (usually Q4_0)
Author
Owner

@yarons commented on GitHub (May 22, 2024):

@lorenzo0932 this is why I added the second command, it uses the model name as a whole with the tag and should work in your case.

<!-- gh-comment-id:2123925502 --> @yarons commented on GitHub (May 22, 2024): @lorenzo0932 this is why I added the second command, it uses the model name as a whole with the tag and should work in your case.
Author
Owner

@gr33k commented on GitHub (May 22, 2024):

I think the ideas and comments posted by people are great.

However.......It would be great to have an ollama pull all or ollama update models, or similar.

Does anyone know how to pull this off with the ollama docker image?

docker exec ollama ollama list | awk -F: 'NR>1 && !/reviewer/ {system("ollama pull "$1)}'
sh: line 1: ollama: command not found

Very difficult to update many models one by one, and the docker image apparently doesn't have awk

<!-- gh-comment-id:2125860574 --> @gr33k commented on GitHub (May 22, 2024): I think the ideas and comments posted by people are great. However.......It would be great to have an ollama pull all or ollama update models, or similar. Does anyone know how to pull this off with the ollama docker image? ``` docker exec ollama ollama list | awk -F: 'NR>1 && !/reviewer/ {system("ollama pull "$1)}' sh: line 1: ollama: command not found ``` Very difficult to update many models one by one, and the docker image apparently doesn't have awk
Author
Owner

@zoeruda commented on GitHub (May 24, 2024):

You can do
docker exec -it ollama /bin/bash
then
apt update && apt install original-awk
then run either command

<!-- gh-comment-id:2130504148 --> @zoeruda commented on GitHub (May 24, 2024): You can do `docker exec -it ollama /bin/bash` then `apt update && apt install original-awk` then run either command
Author
Owner

@finashkin commented on GitHub (May 28, 2024):

If you were looking for how to do it in Windows:

ollama list | Select-Object -Skip 1 | ConvertFrom-String | % {Write-Host -BackgroundColor DarkRed 'updating' $_.p1 'model' ; ollama pull $_.p1}

You can also add this as a function to your PowerShell profile:

$path = $PROFILE
# $path = $PROFILE.AllUsersAllHosts
if (!(Test-Path -Path $path)) {
    New-Item -ItemType File -Path $path -Force
}
Add-Content -Path $path -Value "function ollama-update {ollama list | Select-Object -Skip 1 | ConvertFrom-String | % {Write-Host -BackgroundColor DarkRed 'updating' `$_.p1 'model' ; ollama pull `$_.p1}}"

Use ollama-update after PowerShell reload.

<!-- gh-comment-id:2136093357 --> @finashkin commented on GitHub (May 28, 2024): ## If you were looking for how to do it in Windows: ```powershell ollama list | Select-Object -Skip 1 | ConvertFrom-String | % {Write-Host -BackgroundColor DarkRed 'updating' $_.p1 'model' ; ollama pull $_.p1} ``` You can also add this as a function to your PowerShell profile: ```powershell $path = $PROFILE # $path = $PROFILE.AllUsersAllHosts if (!(Test-Path -Path $path)) { New-Item -ItemType File -Path $path -Force } Add-Content -Path $path -Value "function ollama-update {ollama list | Select-Object -Skip 1 | ConvertFrom-String | % {Write-Host -BackgroundColor DarkRed 'updating' `$_.p1 'model' ; ollama pull `$_.p1}}" ``` Use `ollama-update` after PowerShell reload.
Author
Owner

@oppenheimer- commented on GitHub (Sep 17, 2024):

here is a windows .bat file that worked for me

@echo off
setlocal enabledelayedexpansion

echo Fetching list of Ollama models...
for /f "skip=1 tokens=1" %%a in ('ollama list 2^>nul') do (
    set "model=%%a"
    if not "!model!"=="" (
        echo Updating model: !model!
        ollama pull !model!
    )
)

echo All models have been updated.
pause
<!-- gh-comment-id:2354683022 --> @oppenheimer- commented on GitHub (Sep 17, 2024): here is a windows .bat file that worked for me ```shell @echo off setlocal enabledelayedexpansion echo Fetching list of Ollama models... for /f "skip=1 tokens=1" %%a in ('ollama list 2^>nul') do ( set "model=%%a" if not "!model!"=="" ( echo Updating model: !model! ollama pull !model! ) ) echo All models have been updated. pause ```
Author
Owner

@vishnunuk commented on GitHub (Sep 18, 2024):

How to Update Docker Models with update_model.sh

This script helps you update models within a Docker container by prompting you to choose whether to update all models at once or review and confirm each model individually.

Step-by-Step Guide

1. Open the Script in Nano Editor

Open your terminal and edit the update_model.sh script using the nano editor:

nano update_model.sh

2. Add the Script Content

Copy and paste the following script into the file:

#!/bin/bash

# Get the list of models from the Docker container
models=$(docker exec -it ollama bash -c "ollama list | tail -n +2" | awk '{print $1}')
model_count=$(echo "$models" | wc -w)

echo "You have $model_count models available. Would you like to update all models at once? (y/n)"
read -r bulk_response

case "$bulk_response" in
  y|Y)
    echo "Updating all models..."
    for model in $models; do
      docker exec -it ollama bash -c "ollama pull '$model'"
    done
    ;;
  n|N)
    # Loop through each model and prompt the user for input
    for model in $models; do
      echo "Do you want to update the model '$model'? (y/n)"
      read -r response

      case "$response" in
        y|Y)
          docker exec -it ollama bash -c "ollama pull '$model'"
          ;;
        n|N)
          echo "Skipping '$model'"
          ;;
        *)
          echo "Invalid input. Skipping '$model'"
          ;;
      esac
    done
    ;;
  *)
    echo "Invalid input. Exiting."
    exit 1
    ;;
esac

3. Save and Close the File

To save the file and exit nano, press Ctrl + X, then Y, and finally Enter.

4. Make the Script Executable

Give the script execute permissions using the following command:

chmod +x update_model.sh

5. Run the Script

You can now run the script to update your models:

./update_model.sh

The script will prompt you to choose whether to update all models at once or confirm each model individually. Follow the on-screen instructions to complete the process.

<!-- gh-comment-id:2358423054 --> @vishnunuk commented on GitHub (Sep 18, 2024): # How to Update Docker Models with `update_model.sh` This script helps you update models within a Docker container by prompting you to choose whether to update all models at once or review and confirm each model individually. ## Step-by-Step Guide ### 1. Open the Script in Nano Editor Open your terminal and edit the `update_model.sh` script using the nano editor: ```bash nano update_model.sh ``` ### 2. Add the Script Content Copy and paste the following script into the file: ```bash #!/bin/bash # Get the list of models from the Docker container models=$(docker exec -it ollama bash -c "ollama list | tail -n +2" | awk '{print $1}') model_count=$(echo "$models" | wc -w) echo "You have $model_count models available. Would you like to update all models at once? (y/n)" read -r bulk_response case "$bulk_response" in y|Y) echo "Updating all models..." for model in $models; do docker exec -it ollama bash -c "ollama pull '$model'" done ;; n|N) # Loop through each model and prompt the user for input for model in $models; do echo "Do you want to update the model '$model'? (y/n)" read -r response case "$response" in y|Y) docker exec -it ollama bash -c "ollama pull '$model'" ;; n|N) echo "Skipping '$model'" ;; *) echo "Invalid input. Skipping '$model'" ;; esac done ;; *) echo "Invalid input. Exiting." exit 1 ;; esac ``` ### 3. Save and Close the File To save the file and exit nano, press `Ctrl + X`, then `Y`, and finally `Enter`. ### 4. Make the Script Executable Give the script execute permissions using the following command: ```bash chmod +x update_model.sh ``` ### 5. Run the Script You can now run the script to update your models: ```bash ./update_model.sh ``` The script will prompt you to choose whether to update all models at once or confirm each model individually. Follow the on-screen instructions to complete the process.
Author
Owner

@asakew commented on GitHub (Oct 27, 2024):

Другой вариант ( awkзависит от варианта, но должен работать на большинстве популярных вариантов awk как в Mac, так и в Linux):

ollama list | awk -F: 'NR>1 && !/reviewer/ {system("ollama pull "$1)}'

Пояснение: ollama list- перечисляет все модели, включая строку заголовка и модель «рецензент» (не может быть обновлена).

awk:

  • -F :- установите разделитель полей на «:» (таким образом мы сможем получить название модели без тега - ollama3 :latest).
  • NR > 1- пропустить первую (заголовочную) строку.
  • &&- «и» отношение между критериями.
  • !/reviewer/- отфильтровать reviewerмодель.
  • system("ollama pull "$1)- запустит системную команду: ollama pull <model>если модель зависит от строки, она должна выполняться отдельно для каждого $1найденного (первый столбец, разделенный ":").

Чтобы вытащить с тегом, просто удалите -F::

ollama list | awk 'NR>1 && !/reviewer/ {system("ollama pull "$1)}'

это не работает с моделями не "по умолчанию". Я использую модели с квантованием Q8_0, и этот "скрипт" обновляет только модели "по умолчанию" (обычно Q4_0)

code working) all modules update)
Снимок экрана 2024-10-27 в 11 34 32
Снимок экрана 2024-10-27 в 12 00 40

<!-- gh-comment-id:2439795740 --> @asakew commented on GitHub (Oct 27, 2024): > > Другой вариант ( `awk`зависит от варианта, но должен работать на большинстве популярных вариантов awk как в Mac, так и в Linux): > > ``` > > ollama list | awk -F: 'NR>1 && !/reviewer/ {system("ollama pull "$1)}' > > ``` > > > > > > > > > > > > > > > > > > > > > > > > Пояснение: `ollama list`- перечисляет все модели, включая строку заголовка и модель «рецензент» (не может быть обновлена). > > #### `awk`: > > > > * `-F :`- установите разделитель полей на «:» (таким образом мы сможем получить название модели без тега - **ollama3** :latest). > > * `NR > 1`- пропустить первую (заголовочную) строку. > > * `&&`- «и» отношение между критериями. > > * `!/reviewer/`- отфильтровать `reviewer`модель. > > * `system("ollama pull "$1)`- запустит системную команду: `ollama pull <model>`если модель зависит от строки, она должна выполняться отдельно для каждого `$1`найденного (первый столбец, разделенный ":"). > > > > Чтобы вытащить с тегом, просто удалите `-F:`: > > ``` > > ollama list | awk 'NR>1 && !/reviewer/ {system("ollama pull "$1)}' > > ``` > > это не работает с моделями не "по умолчанию". Я использую модели с квантованием Q8_0, и этот "скрипт" обновляет только модели "по умолчанию" (обычно Q4_0) code working) all modules update) <img width="733" alt="Снимок экрана 2024-10-27 в 11 34 32" src="https://github.com/user-attachments/assets/f2c54cb4-7f98-4b43-9513-b02f8955beb4"> <img width="1440" alt="Снимок экрана 2024-10-27 в 12 00 40" src="https://github.com/user-attachments/assets/4d826a32-04d2-46f6-929c-97b8d7180f33">
Author
Owner

@agarzon commented on GitHub (Nov 27, 2024):

For Windows as .BAT script:

@echo off
setlocal enabledelayedexpansion

rem List all models and skip the first line
for /f "skip=1 tokens=*" %%i in ('ollama list') do (
    rem Extract the model name from the output
    set "model=%%i"
    
    rem Split the model name from the rest of the line (assuming space-separated)
    for /f "tokens=1" %%j in ("!model!") do (
        rem Pull the model using ollama
        ollama pull %%j
    )
)

endlocal
<!-- gh-comment-id:2502647883 --> @agarzon commented on GitHub (Nov 27, 2024): For Windows as .BAT script: ```bat @echo off setlocal enabledelayedexpansion rem List all models and skip the first line for /f "skip=1 tokens=*" %%i in ('ollama list') do ( rem Extract the model name from the output set "model=%%i" rem Split the model name from the rest of the line (assuming space-separated) for /f "tokens=1" %%j in ("!model!") do ( rem Pull the model using ollama ollama pull %%j ) ) endlocal ```
Author
Owner

@gr33k commented on GitHub (Dec 6, 2024):

Ok so doing the following updates all models (Linux)....

docker exec -it ollama /bin/bash
apt update && apt install original-awk
ollama list | tail -n +2 | awk '{print $1}' | while read -r model; do
  ollama pull $model
done

(Note: the apt line only has to be done once to install awk - after that, no longer needed)

Thank you all for the work-arounds...but shocked there isn't a built-in easy "upgrade all models" arg.

Wasn't there a command that updated all models before...did it get removed? Why isn't there are ollama pull all or something...seems like a good feature :)

<!-- gh-comment-id:2524080476 --> @gr33k commented on GitHub (Dec 6, 2024): Ok so doing the following updates all models (Linux).... ``` docker exec -it ollama /bin/bash apt update && apt install original-awk ollama list | tail -n +2 | awk '{print $1}' | while read -r model; do ollama pull $model done ``` (Note: the apt line only has to be done once to install awk - after that, no longer needed) Thank you all for the work-arounds...but shocked there isn't a built-in easy "upgrade all models" arg. Wasn't there a command that updated all models before...did it get removed? Why isn't there are ollama pull all or something...seems like a good feature :)
Author
Owner

@chiragkrishna commented on GitHub (Mar 5, 2025):

put this in your ~/.bashrc or ~/.zshrc and call it using "ollama_update"

ollama_update() {
    ollama list | awk 'NR>1 {print $1}' | while read package; do
        echo "Updating $package..."
        ollama pull "$package"
    done
}
<!-- gh-comment-id:2700509370 --> @chiragkrishna commented on GitHub (Mar 5, 2025): put this in your ~/.bashrc or ~/.zshrc and call it using "ollama_update" ```bash ollama_update() { ollama list | awk 'NR>1 {print $1}' | while read package; do echo "Updating $package..." ollama pull "$package" done } ```
Author
Owner

@BarryStainsby commented on GitHub (Jun 14, 2025):

I'd like to have a way to update all downloaded models. Right now I have to pull each model separately.

There's a really easy method that involves only a single button push in Open WebUI. For reference I use Windows 11 OS.

I followed Naomi Brockwell's Ollama set-up video and included installation of Open WebUI as a container running inside Docker.
https://youtu.be/CVeZfM0pVyU?si=ElhwAwkfVdpWSpe9

I update ALL of my models at once with a single click of the 'Update all models' button inside Open WebUI.

The 'Update all models' button lives in the Admin Panel, Settings, Models area.
Look for the download icon in the upper right hand side. Then there's an 'Update all models' button

That's it!

Btw, to keep Open WebUI up to date in Docker, install 'watchtower' (https://github.com/containrrr/watchtower), then, in terminal, run the command:

docker run --rm -v //var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once

Do this whenever Open WebUI declares that an update is available.

Good luck! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ↓ (this button!!!)

Image

<!-- gh-comment-id:2972606127 --> @BarryStainsby commented on GitHub (Jun 14, 2025): > I'd like to have a way to update all downloaded models. Right now I have to pull each model separately. There's a really easy method that involves only a single button push in Open WebUI. For reference I use Windows 11 OS. I followed Naomi Brockwell's Ollama set-up video and included installation of Open WebUI as a container running inside Docker. https://youtu.be/CVeZfM0pVyU?si=ElhwAwkfVdpWSpe9 I update ALL of my models at once with a single click of the 'Update all models' button inside Open WebUI. The 'Update all models' button lives in the Admin Panel, Settings, Models area. Look for the download icon in the upper right hand side. Then there's an 'Update all models' button That's it! Btw, to keep Open WebUI up to date in Docker, install 'watchtower' (https://github.com/containrrr/watchtower), then, in terminal, run the command: docker run --rm -v //var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once Do this whenever Open WebUI declares that an update is available. Good luck! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ↓ (this button!!!) ![Image](https://github.com/user-attachments/assets/8dac682c-343d-44d8-87d7-8504a1ba5967)
Author
Owner

@somera commented on GitHub (Oct 26, 2025):

I build new script for my updates: https://gist.github.com/somera/18d87aa5e2a35a939a64d11a62ddedf0

Sample output ...

Image
<!-- gh-comment-id:3448659322 --> @somera commented on GitHub (Oct 26, 2025): I build new script for my updates: https://gist.github.com/somera/18d87aa5e2a35a939a64d11a62ddedf0 Sample output ... <img width="723" height="247" alt="Image" src="https://github.com/user-attachments/assets/68481009-3f50-4d8b-8fc0-b2c60e7003e0" />
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#47596