3

NOTE: This question was valid for Chocolatey 0.9.8 and bellow. Later versions are completely rewritten from PowerShell scripts to a C# application and whole process of package management was improved a lot.

I have been using Chocolatey for some time. At the beginning I was excited, but after some time I'm not sure if it's usable yet. I'm concerned the most about proper way of package updating.

For example, I have installed Atom editor using Chocolatey. New versions of Atom are released pretty frequently, so I have updated this package several times. Then I noticed that I have all previously installed versions of Atom still present in a Chocolatey's lib directory. Chocolatey in fact doesn't update a package; it just installs a new version besides an older one, and it doesn't matter if you use a command choco update <package> or choco update all. And there is also currently no way to uninstall previously installed packages using Chocolatey except of the most recent one.

Therefore I wonder what's the proper way of managing package versions using Chocolatey. Should I just manually remove older versions of packages and hope there are no dependencies outside of Chocolatey's package directory?

Or rather do this?

choco uninstall <package>
choco install <package>

What if I don't have installed just one package using Chocolatey, but tens of packages?

Also the fact that each version of package is in individual directory causes various issues (like for example this, this or this).

I don't think this is suitable for real usage. Or maybe I'm missing something. Actually I wish I'm missing something :) Because software management on Windows is quite a pain for years. It's a mess.

I would say that Chocolatey works more as a dependency manager, but it should be a package manager. It advertises itself as "apt-get for Windows" and apt-get is a package manager. There is a quite big difference between a package managers (like Chocolatey, apt-get or brew) and a dependency managers (like npm or bower). Each one of these two approaches is good for different purpose. Who needs to use different versions of Git, Atom, VLC media player, Chrome, etc. at the same time?

It's also discussed for example here and here, but nothing has changed during a year. It seems that it should be addressed in a new client written in C# instead of PowerShell, but it wasn't released yet (should be released before the end of 2014). Until then I don't see any added value in Chocolatey.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
David Ferenczy Rogožan
  • 23,966
  • 9
  • 79
  • 68

2 Answers2

7

UPDATE: In choco 0.9.9+ (C# compiled version) this is no longer the case.

You are correct. Chocolatey folders can get really crazy with updates over time with the PowerShell version. FWIW, the PowerShell version of Chocolatey was an experiment that has stuck around for too long. I've been talking about rewriting it since the end of the first year. Agreed that what you are seeing is ugly. Rest assured this is not how the new version works. There are some packages right now where you do install multiple versions (Ruby and Python), but they are few and far between.

The early designs of Chocolatey were somewhat dependent on NuGet.exe which doesn't have all of the same functionality that NuGet.Core.dll has as far as package management (although it's got some really obtuse bugs that I've filed while writing the C# version of choco).

I'm really excited to release the new version, but the feature parity needs to be there first. It will be FOSSed either just before release or at the same time. It is the version that is going to support the professional/business extensions. There is no way I would attempt to do that with the current PowerShell version. ;)

Right now you can manually jump into the lib folder and delete all of the older folders. The older versions are not even considered there by Chocolatey in most cases. It's looking at only the latest versions. The only mistake it is making is not deleting the older folders (and using version on the folder in the first place).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ferventcoder
  • 11,952
  • 3
  • 57
  • 90
  • Thank you. When do you think the new C# version could be released? – David Ferenczy Rogožan Nov 16 '14 at 02:36
  • 1
    BTW good to see that your [KickStarter campaign](https://www.kickstarter.com/projects/ferventcoder/chocolatey-the-alternative-windows-store-like-yum) was successful. 888 backers :) A few days ago it didn't look that it'll be funded. I hope it'll push Chocolatey to the another level. – David Ferenczy Rogožan Nov 16 '14 at 02:48
  • 1
    Now that we are funded, I can shift focus over to the C# version as getting it ready is the first steps into the pro/business versions. – ferventcoder Nov 16 '14 at 07:17
  • 1
    Thanks, this is the first initiative for a Windows package manager that looks promising, that I have seen. I have seen a few attempts over the years. – Prof. Falken Dec 08 '14 at 12:33
1

To update a package, use the Chocolatey update command.

It's simple:

chocolatey update <package>

OR

cup <package>

UPDATE in comments

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Dima Pasko
  • 1,170
  • 12
  • 20
  • Sure, that's the issue I'm describing. If you execute whichever of that commands, `Chocolatey` does a new installation instead of an update. I have updated *Atom* editor using `choco update` command 5 times and I have 5 different version installed in a `Chocolatey`'s `lib` directory. – David Ferenczy Rogožan Nov 11 '14 at 17:52
  • This is Chocolatey's local cache feature. Most of package management tools such as `npm` or `bower` do this in the same way. Unfortunately clean cache feature not implemented yet https://github.com/chocolatey/chocolatey/issues/595 – Dima Pasko Nov 11 '14 at 18:12
  • I would say that there is a big difference between package managers (like `Chocolatey`, `apt-get` or `brew`) and dependency managers (like `npm` or `bower`). `Chocolatey` says it's `apt-get` for Windows, but in fact acts similarly like dependency manager, what doesn't make a sense at all to me. Who need to use different versions of Git, Atom, VLC etc. at the same time? Each one of these two approaches is good for different purpose. – David Ferenczy Rogožan Nov 11 '14 at 18:18
  • 1
    Also "local cache" isn't actually a feature since `Chocolatey` is not able to use it in any way. Even if you install already installed version of a package, it downloads it again. So I even wouldn't call it a "local cache". `Chocolatey` simply can install a package, nothing more. Update is just a new installation. No package manager works like that. Currently the only benefit of `Chotolatey` is that it provides a software repository, where everything is on one place. Client is really bad, even though it's developed for several years. I'm looking forward for a new client rewritten in C#. – David Ferenczy Rogožan Nov 12 '14 at 01:05
  • @DawidFerenczy - missing one keyword - "Like" apt-get. ;) – ferventcoder Nov 12 '14 at 04:13