What directory does chocolatey install commands to?
Asked Answered
R

2

30

I've successfully done choco install python2 and choco install python3 but I can't see the result on cmd.exe (yes, I reopened non-administrator cmd.exe).

Where does chocolatey install commands to? I'll fix my PATH env-var when I can work out what should be there.

Choclatey's FAQ does not include an answer to this question. I'm more used to homebrew (Mac), and the answer for that is /usr/local/bin/

Runaway answered 5/4, 2016 at 14:30 Comment(0)
T
27

The answer is, it depends :-)

Most package contents will be installed to the chocolatey directory, which you can find at C:\ProgramData\chocolatey\lib. For example, in the case of python3 you will find the exe in C:\ProgramData\chocolatey\lib\python3\tools.

In addition, you will find a shim exe located at C:\ProgramData\chocolatey\bin for python. This location is already contained within your path, so you should already have access to it without making any other changes.

Tangent answered 5/4, 2016 at 18:50 Comment(1)
Additionally, in 0.9.10 (beta at the time of this writing) shows what path items have changed and allows you to refreshenv without leaving and restarting your console.Beatify
M
18

You can run this command for an installed package

choco list --local-only --exact python --trace

Which will have an output like

Chocolatey v0.10.15
 Operating System Version Number: 10.0.18363.0
Initializing global mutex
Waiting on the mutext handle for 2000 milliseconds
Entered mutex to deserialize 'C:\ProgramData\chocolatey\.chocolatey\python.2.7.11\.registry'
Initializing global mutex
Waiting on the mutext handle for 2000 milliseconds
Entered mutex to deserialize 'C:\ProgramData\chocolatey\.chocolatey\python.2.7.11\.files'
python 2.7.11
1 packages installed.

Open the C:\ProgramData\chocolatey\.chocolatey\python.2.7.11\.files and you will see

<?xml version="1.0" encoding="utf-8"?>
<fileSnapshot xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <files>
    <file path="C:\ProgramData\chocolatey\lib\python\python.nupkg" checksum="8217F64EF970491C464DAA20F6BF45F1" />
    <file path="C:\ProgramData\chocolatey\lib\python\python.nuspec" checksum="4F62CF5DD7934CF4C8ED62FE24848C72" />
    <file path="C:\ProgramData\chocolatey\lib\python\tools\chocolateyInstall.ps1" checksum="6EBF6A5BBC8667B7DEE75CA2E0CF2EB4" />
  </files>
</fileSnapshot>

Pointing to C:\ProgramData\chocolatey\lib\python as the installation folder.

Madlin answered 23/12, 2020 at 11:20 Comment(2)
This is the right answer. Works for every package and every choco version. The other version does not give the correct result (at least on my system)Pliocene
That's a start, but nothing more convenient for CI/CD? Sometimes paths are needed :/Groscr

© 2022 - 2024 — McMap. All rights reserved.