Installing programs in git bash?

I'm running git bash on windows and I'd like to install some of the linux tools I'm familiar with but apt-get, yum, etc don't appear to work. How can I install programs in git bash?


Solution 1:

You can use chocolatey or scoop which will allow you to install software from the command line and they do work on git bash. But if you really want linux software you can install windows 10 then the windows linux subsystem which does allow you to use apt-get if you choose Ubuntu over Opensuse.

Solution 2:

Git Bash does not seem to have a package manager.

When using Cygwin or MobaXterm (and there may be more derivatives), you actually can use apt-get like it's ubuntu.

Solution 3:

You can download the binary exe file from sites that provide windows exe binaries of linux commands and add it to the Git binaries folder (under the path /c/Program\ Files/Git/mingw64/bin). Check this out:

Example:

To install wget and I quote from https://gist.github.com/evanwill/0207876c3243bbb6863e65ec5dc3f058:

  • Download the lastest wget binary for windows from eternallybored (they are available as a zip with documentation, or just an exe)
  • If you downloaded the zip, extract all (if windows built in zip utility gives an error, use 7-zip).
  • Rename the file wget64.exe to wget.exe if necessary.
  • Move wget.exe to your Git\mingw64\bin\.

To download nano:

  • Download the Nano binary from Nano win32-support page. You just need the .exe file, which is named nano-git-0d9a7347243.exe (as of this writing).
  • Rename the file to nano.exe, and copy to the mingw64\bin directory.
  • This version of Nano will not work with Git Bash alone, but can be invoked using winpty, for example, winpty nano test.txt.

As of 2018, recent versions of Git Bash include Nano, so this is unnecessary! Just be sure to choose Nano as your default editor when installing Git for Windows.

You can also consider using cygwin as a unix-like systems emulator on Windows, where a wide variety of binaries can be included upon installation, and can be added later on.