How do I automatically keep all locally installed Chocolatey packages up to date?
Asked Answered
B

7

84

There is Ketarin to update Chocolatey packages and push them to chocolatey.org automatically, but how do I automatically update all locally installed Chocolatey packages?

Batch answered 4/7, 2014 at 18:12 Comment(1)
Schedule cup all? github.com/chocolatey/chocolatey/wiki/CommandsUpdateKimberykimble
L
152

Try choco upgrade all -y. One can create a scheduled task to run in the evenings that would do this.

Lazo answered 5/7, 2014 at 14:10 Comment(5)
We have also discussed that we would make this a feature of ChocolateyGUI, but as yet, we have not had a chance to include this.Coburn
@GaryEwanPark Would be nice to have that feature in the ChocolateyGUI!Justly
Sometimes updating packages hits an error that requires manual intervention. Would a scheduled task report that?Ecology
It would be in the log @CarlWalsh but without something like growl hooked up it would not report it.Lazo
Thanks @Lazo and congrats to the first 10K;)Chokecherry
P
19

Update - Sept 2018

As well as choco-upgrade-all-at-startup to upgrade all packages on startup (mentioned above), there is also now a Chocolatey package, choco-upgrade-all-at, that can be used to check/upgrade all packages as often (for example, daily, weekly..) as you require, at a time that suits :-)

A downside of using the public repository of course is that you are dependent on other people to maintain the packages largely out of the goodness of their hearts, so you should probably still run something like SUMo once in a while to keep an eye on things if you are using this to keep your own machines up-to-date. Organisations are strongly encouraged to host and maintain their own repository rather than use the public one for this reason.

Portuna answered 18/9, 2018 at 11:59 Comment(0)
B
5

Another option is to use the choco-upgrade-all-at-startup package by issuing:

choco install choco-upgrade-all-at-startup -y

Once the installation is complete, a scheduled task has been created that upgrades all packages when the computer boots. Note: if one uses a laptop, please ensure that this is on AC power. Otherwise the scheduled task will not be run and the chocolatey packages will not be updated.

Batch answered 22/4, 2018 at 12:22 Comment(0)
C
4

Note: this answer was relevant for some quite old version of Chocolatey (0.9.8 and older).

You should be aware that Chocolatey in fact doesn't update already installed packages (neither cup all or cup <package>), but rather installs a newer version(s) beside older one(s). So you'll end up with a stack of previously installed versions of a package(s) on your system. And there is currently no way to uninstall the specific version of the package except the most recent one using Chocolatey.

UPDATE: according to @ferventcoder's comment, Chocolatey of version 0.9.9+ does a real update now! This is huge improvement actually. Versions 0.9.8 and bellow do just an install as described earlier. See release notes for details about new C# client.

Cree answered 11/11, 2014 at 17:1 Comment(6)
Sadly you can't. See uninstall command description. version argument is ignored and Chocolatey removes the most recent version. Tested using version 0.9.8.28.Punctuation
It seems the uninstall command is particularly unusable in this case. :/Lazo
@Lazo Exactly. Actually whole Chocolatey seems to be unusable to me. I mean the client. Repository alone is great, but there is a lot of similar repositories on the internets. I have described my disappointment here. I hope new C# client will solve this issues.Punctuation
@Lazo Oh, you already have read it, since you answer to that question :)Punctuation
We can edit this question now to state that 0.9.9+ does do this and 0.9.8 and below don't do this.Lazo
@Lazo Nice! Should I test it or can I trust you? :)Punctuation
U
3

For choco v0.10.1+, use:

choco upgrade

https://github.com/chocolatey/choco/wiki/CommandsUpgrade

From v1.0.0 choco update is deprecated:

DEPRECATION NOTICE - choco update is deprecated and will be removed or
 replaced in version 1.0.0 with something that performs the functions
 of updating package indexes. Please use `choco upgrade` instead.
Undaunted answered 2/2, 2017 at 9:47 Comment(0)
P
2
cup all -y

or

chocolatey update all -y
Porcine answered 30/3, 2015 at 20:10 Comment(1)
DEPRECATION NOTICE - choco update is deprecated and will be removed or replaced in version 1.0.0 with something that performs the functions of updating package indexes. Please use choco upgrade instead.Forage
L
0

Using Task Scheduler you can run choco upgrade all -y at a specific time.

Here is a sample script to save as xml file and import

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2024-07-14T09:04:55.3522974</Date>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <StartBoundary>2024-07-14T11:04:00+02:00</StartBoundary>
      <Enabled>true</Enabled>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <LogonType>InteractiveToken</LogonType>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>true</WakeToRun>
    <ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>choco</Command>
      <Arguments>upgrade all -y</Arguments>
    </Exec>
  </Actions>
</Task>

you can tweak it in Task Scheduler afterwards.

Laryngology answered 16/7 at 9:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.