17

The OneGet PowerShell module should ship with the default repository being Chocolatey. This is shown in the documentation found here. However when I run Get-PackageSource it returns PSGallery and MSPSGallery as the sources.

How can I manually set the package source to Chocolatey?

I have tried running:

Register-PackageSource -Name chocolatey -ProviderName Chocolatey -Location http://chocolatey.org/api/v2/

But it returns a warning saying:

Unable to find package provider 'Chocolatey'

  • Are you running the April 2014 or September 2014 preview version of PowerShell 5.0? – Mathias R. Jessen Oct 4 '14 at 19:12
  • Did the answer from erik worked for you? I have exact the same issue and tried eriks command, without an error but also without succes. Still now package repository. I'm running the september version of wmf 5.0 on Win 8.1. – user247587 Oct 10 '14 at 20:09
  • @NoAgenda33: Does "Chocolatey" show in the provider list when you run "Get-PackageProvider"? – DonBecker Apr 9 '15 at 23:01
14

I was looking for the same. This works on the PowerShell version that comes with Windows 10 TP:

register-packagesource -Name chocolatey -Provider PSModule -Trusted -Location http://chocolatey.org/api/v2/ -Verbose
  • Does this add the new package source as a Chocolatey package source or as a PSModule source? – DonBecker Apr 9 '15 at 23:02
  • 2
    I had to do this on Windows 10 but had to make a small change: the Provider must be set to Chocolatey. That is: register-packagesource -Name chocolatey -Provider Chocolatey -Trusted -Location http://chocolatey.org/api/v2/ -Verbose Note: this command was preceded by the following: Get-PackageProvider -Name chocolatey – Ivan Muzzolini Sep 22 '16 at 9:02
4

Erik's answer didn't work for me. It gives an error:

register-packagesource : Unable to find package providers (PSModule)

This worked though:

PS> Get-PackageSource -Provider chocolatey

And then this command works (for example):

PS> find-package -name chocolatey -provider chocolatey

For reference, my PowerShell version is:

Major  Minor  Build  Revision
-----  -----  -----  --------
5      0      10586  122

protected by Community Oct 23 '14 at 23:02

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.