I'm reading wiki on github for git and it says that msys2 bundles pacman: https://github.com/git-for-windows/git/wiki/Package-management
But when i'm invoking it:
$ pacman
bash: pacman: command not found
Does anyone has an idea what is going on? To which git version this wiki refers? Is there a way to install additional packages to msys2 inside Git for windows?
As mentioned in issue 397:
The bash that you see in the latest git for Windows (2.5.3), which is a more recent bash than the old msysgit one, is only there to execute git commands.
It is not a full-fledged linux environment to install any third-party package.
I did not want to move from my already working Git for Windows installation so I improvised a bit:
${git-sdk}/usr/bin/pacman.exe
to${git}/usr/bin
${git-sdk}/etc/pacman.conf
and${git-sdk}/etc/pacman.d
to${git}/etc
${git-sdk}/var
to${git}/
That's all. You can now open your Git Bash and run
pacman -S python
to install packages on your existing Git for Windows setup.You will need write access to Git for Windows directory. Also, your
pacman
now thinks it has a lot of packages installed (from SDK) but it did not stop me from using it.There seems to be a documented way to do this without having to install the Git for Windows SDK (which is very large). I was given the link to this info by PhilipOakley when I asked about all this on GitHub issue #1912.
Here's the current text of the Git for Windows GitHub wiki page about it:
Git for Windows (https://gitforwindows.org/ or https://git-scm.com/downloads) (has Git Bash) but it does not include
tree
.tree
is available for viapacman
(Package Manager) but that is only available if you install "Git for Windows SDK" (scroll to the bottom of https://gitforwindows.org/ which provides a link to download installer for it from https://github.com/git-for-windows/build-extra/releases/latest)This SO: "Package management in git for windows?" was very helpful Package management in git for windows?
Also as commented in the above SO, they link to this git for windows issue [Pacman missing on fresh 2.5.2 install #397] that it was intended to not include
pacman
in the default install.Anyways, I installed "Git for Windows SDK", then in it's bash prompt (SDK-64) I ran the following to install current tree v1.7.0-1 (as of this posting Aug 30, 2018):
On my system, Git for Windows SDK is installed under:
C:\git-sdk-64
, so from my Git for Windows Bash shell (that did not have tree installed), I copied it over tree.exe to it's /usr/bin directory, e.g.Now I can run
tree
v1.7.0 from both Git Bash shells.So, to make it even easier for others and maybe myself on a future machine, I looked at where
pacman
was getting thetree
package from by running following in my Git for Windows SDK Bash terminal:The key thing, here is that
pacman
is getting it from the "msys" repository (FYI: even though it says msys, it really is using msys2), so I looked at/etc/pacman.d/mirrorlist.msys
and the first mirror points tohttp://repo.msys2.org/msys/$arch/
So next time you want a package that is NOT in Git for Windows, you can download them from: http://repo.msys2.org/msys/x86_64/ (for 64-bit) or from http://repo.msys2.org/msys/i686/ (32-bit)
e.g. direct download link for tree v1.7.0-1
FYI: Git SCM's Window's download at https://git-scm.com/download/ pulls the latest from Git for Windows GitHub (https://github.com/git-for-windows/git from the https://github.com/git-for-windows/git/releases/ link)