Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
how to add more utilities to git bash for windows, wget, make

How to add more to Git Bash on Windows

Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.

The basic idea is that C:\Program Files\Git\mingw64\ is your / directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git, the mingw64 in this directory is your root. Find it by using pwd -W). If you go to that directory, you will find the typical linux root folder structure (bin, etc, lib and so on).

If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so you should rename the .exe file to the standard name. Since bin is on the PATH, it will be automatically available to Git Bash.

Note: Many interactive utilities, such as python, ipython or nano, will not display properly with Git Bash's mintty terminal. Try invoking them with winpty instead, for example winpty ipython will work nicely. The Git-for-Windows team is focused on supporting Git, not a full UNIX shell environment. If you are interested in more complete package with build tools, check my notes on Cygwin or Cmder--or install Windows Subsystem for Linux or WSL2.

Here are some utilities to add:

Wget

  • 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\.

Note: I have noticed some bugs when using Wget on Git Bash to create WARC files. For more complex use of Wget, consider Cygwin instead.

Hugo

Hugo static site generator can be downloaded as a binary and does not have a installer. Dropping it into your bin easily adds it to your Git Bash path. Grab the Windows 64-bit version from the releases page. Unzip the download, then copy hugo.exe into your Git\mingw64\bin directory.

Xpdf

Xpdf is a handy utility for manipulating PDF files.

  • Download the windows version "Xpdf tools".
  • Extract zip.
  • Copy the contents of xpdf-tools-win-4.00\bin64\ into your Git\mingw64\bin\.
  • Check the docs to get started with tools such as pdftotext and pdftopng.

ExifTool

  • Download the "stand-alone Windows Executable" from the ExifTool page (this will be a .zip file e.g. "exiftool-11.99.zip").
  • Unzip the downloaded file.
  • Inside you will find a file named exiftool(-k).exe. Rename it to exiftool.exe.
  • Move exiftool.exe to your Git\mingw64\bin\.

Other possibilities

Most utilities that provide binary releases for Windows can be added to GitBash following the same pattern. Here are some more handy examples:

make

Keep in mind you can easy add make, but it doesn't come packaged with all the standard UNIX build toolchain--so you will have to ensure those are installed and on your PATH, or you will encounter endless error messages.

  • Go to ezwinports.
  • Download make-4.1-2-without-guile-w32-bin.zip (get the version without guile).
  • Extract zip.
  • Copy the contents to your Git\mingw64\ merging the folders, but do NOT overwrite/replace any existing files.

Nano

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.

  • 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.
@enceladus181
Copy link

enceladus181 commented May 3, 2019

Thanks, man! It really helped

@MamtaVenugopal
Copy link

MamtaVenugopal commented Jul 14, 2019

Screenshot (133)

@MamtaVenugopal
Copy link

MamtaVenugopal commented Jul 14, 2019

Can anybody tell me what is the mistake I am doing and why is the permission denied when I copying the wget.exe and make files

@gutruaircraft
Copy link

gutruaircraft commented Jul 17, 2019

make cmd is showing an error.so, someone, please help this situation, guys.

chmod +x *.sh
g++ -std=c++11 -Iinclude/ -I3rdparty/stb/include -DOPENCV pkg-config --cflags opencv -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -c ./src/image_opencv.cpp -o obj/image_opencv.o
/usr/bin/sh: pkg-config: command not found
In file included from ./src/image.h:3,
from ./src/image_opencv.h:4,
from ./src/image_opencv.cpp:1:
include/darknet.h:17:10: fatal error: pthread.h: No such file or directory
#include <pthread.h>
^~~~~~~~~~~
compilation terminated.
make: *** [Makefile:149: obj/image_opencv.o] Error 1

This is how it shows the error.

@Patsjemoe
Copy link

Patsjemoe commented Aug 3, 2019

Hi,
I executed make as mentioned, problem is still the same.
Any suggestion ? (command not found)
regards

@adamcanray
Copy link

adamcanray commented Oct 7, 2019

BIG Thanks!!

@kal-9
Copy link

kal-9 commented Oct 28, 2019

Thanks @evanwill - great tip. Git-Bash is a huge plus and this just makes it even more useful!

@gutruaircraft and @Patsjemoe compiling software requires a large toolchain of other utilities in addition to 'make'. Trying to compile software in a synthetic Linux environment on Windows might be asking a little too much... (see evanwill's comment July 22 2017)

@KeilChris
Copy link

KeilChris commented Dec 18, 2019

Thanks, works like a charm. I have added xmllint to git for Windows in no time!

@DheerajArora5
Copy link

DheerajArora5 commented Dec 26, 2019

while zipping in cmd or git bash - getting error like

7z:command not found 

solution:

  • install 7z in your machine
  • set the path in Environment Variables -> User Variables
  • path -> edit -> new (add the path - C:\Program Files\7-Zip) -> OK

Now to use 7z in git Bash

  • Go to C:\Program Files\7-Zip and copy 7z.exe file
  • Go to C:\Program Files\Git\usr\bin and paste 7z.exe file

Now, you will be able to use 7z with Git Bash

@Phartheben
Copy link

Phartheben commented Jan 20, 2020

Thanks, it still works!

@OmamaElrefaei
Copy link

OmamaElrefaei commented Jan 26, 2020

Thanks, it was helpful.

@santiagotoledo91
Copy link

santiagotoledo91 commented Jan 28, 2020

Thank you!!!

@StephenHosking
Copy link

StephenHosking commented Feb 6, 2020

Top hit in google for "wget for git bash" and worked first time. Thanks! I'm up and wget'ting.

@volkov-maxim
Copy link

volkov-maxim commented Mar 3, 2020

Thank you a lot!

@hluu5
Copy link

hluu5 commented Mar 23, 2020

$ make
cd src && C:/Program Files/Git/mingw64/bin/make.exe all
/usr/bin/sh: C:/Program: No such file or directory
make: *** [Makefile:6: all] Error 127

I got this problem. I tried chocolatey install make, too. But that didn't help. Anyone know how to fix this? Thanks

@scozma
Copy link

scozma commented Mar 23, 2020

Thank you!

@paalped
Copy link

paalped commented May 5, 2020

Can anybody tell me what is the mistake I am doing and why is the permission denied when I copying the wget.exe and make files

SHIFT right-click git-bash -> run as administrator:

mv /c/Users/lenovo/Downloads/wget.exe /bin/wget.exe

@Whisper94
Copy link

Whisper94 commented May 6, 2020

make cmd is showing an error.so, someone, please help this situation, guys.

chmod +x *.sh

g++ -std=c++11 -Iinclude/ -I3rdparty/stb/include -DOPENCV pkg-config --cflags opencv -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -c ./src/image_opencv.cpp -o obj/image_opencv.o
/usr/bin/sh: pkg-config: command not found
In file included from ./src/image.h:3,
from ./src/image_opencv.h:4,
from ./src/image_opencv.cpp:1:
include/darknet.h:17:10: fatal error: pthread.h: No such file or directory
#include <pthread.h>
^~~~~~~~~~~
compilation terminated.
make: *** [Makefile:149: obj/image_opencv.o] Error 1
This is how it shows the error.

How have you solved this error?

@Moriarty16
Copy link

Moriarty16 commented Aug 7, 2020

wget works well, thanks mate.

@lpossberg
Copy link

lpossberg commented Sep 16, 2020

Works! Super happy, thanks!

@drg-developer-2
Copy link

drg-developer-2 commented Oct 3, 2020

Hey for me, installing cygwin alongside Git Bash works great! I just added C:\cygwin64\bin to the system Path and Git Bash can now find all utilities installed by the cygwin package manager.

There is a way to make a script that calls the cygwin installer at the command line...I'll try to find it and post.

Update:

I forget which computer I set cyg-get up on but thanks to the poster on https://stackoverflow.com/a/23120293/2580891, I think this is where I found out how to do it. Just add the following alias to ~/.bashrc:

alias cyg-get="/cygdrive/c/cygwin64/setup-x86_64.exe -q -P"

Usage is:

cyg-get <package-name>

Here is another tool I haven't tried but others have had success with: https://github.com/transcode-open/apt-cyg

@NaViGatorFL
Copy link

NaViGatorFL commented Oct 6, 2020

Hey for me, installing cygwin alongside Git Bash works great! I just added C:\cygwin64\bin to the system Path and Git Bash can now find all utilities installed by the cygwin package manager.

There is a way to make a script that calls the cygwin installer at the command line...I'll try to find it and post.

How you did that I need to install automake, autoconf, libtool, pkg-config in gitbash but i was successful in cygwin. Where did you add the system path?

@drg-developer-2
Copy link

drg-developer-2 commented Oct 6, 2020

@NaViGatorFL:

Here are instructions for adding a path to the system path: https://www.computerhope.com/issues/ch000549.htm

That should work but I haven't tried doing advanced C++ builds etc. in cygwin that I remember. It should work, but if you run into issues and you are able to build on Linux instead, one thing you could try is a Linux virtual machine. Doesn't help if you're trying to build for Windows of course.

@evanwill
Copy link
Author

evanwill commented Oct 7, 2020

Neat trick @drg-developer-2!

@NaViGatorFL getting all the build tools can be a big pain--it sounds like you got it working in cygwin, so that sounds good.

However, for everyone running into tool chain issues, Windows recently made installing WSL much easier and smooth. I would suggest using it rather than Git Bash for anything complicated. Plays nice with Windows and easy to use compared to virtual machine. WSL2 is even better. It feels a lot like using cygwin, but is actually just full real linux terminal.
Some notes from a few months ago: https://evanwill.github.io/_drafts/notes/wsl.html

@drg-developer-2
Copy link

drg-developer-2 commented Oct 7, 2020

@evanwill great point about WSL, I keep forgetting that is an option. I tried it about 2 years ago then switched back to cygwin. But if WSL has enough features it could potentially have better file system integration among other things. Although I would be curious to see if there is a package manager and how well it works, what tools are available etc.

@Rodgath
Copy link

Rodgath commented Feb 19, 2021

Shukrani!!! You saved the day.

@Sleavely
Copy link

Sleavely commented Mar 9, 2021

I love this guide so much, I've been referring to it for years 😍

I'd like to suggest adding jq which is a superb tool in many developers' belt these days. Basically all you have to do is:

  1. Download the latest Windows executable of your choice from https://github.com/stedolan/jq/releases
  2. Put it in your Git\mingw64\bin folder
  3. Rename to jq.exe

@adminlinzi
Copy link

adminlinzi commented Sep 27, 2021

my system is window10 pro, download the packege from wget software site(https://eternallybored.org/misc/wget/), move the wget.exe to the installed path (C:\Git\mingw64\bin).
open the git bash window, input wget, i can use it.

@bennycode
Copy link

bennycode commented Nov 2, 2021

Thank you for sharing how to install make. It worked for me on Windows 10 with Git for Windows v2.33.0 (64-bit) and make-4.3-without-guile-w32.

It's also possible to install git secret by doing the following:

git clone git@github.com:sobolevn/git-secret.git
cd git-secret
make build
PREFIX="/usr/local" make install

@chenxiaoxia2019
Copy link

chenxiaoxia2019 commented Dec 13, 2021

Thanks for sharing how to install make.
make-4.3-without-guile-w32 works for me on Windows 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment