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.

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.
@DWiechert

This comment has been minimized.

Copy link

@DWiechert DWiechert commented Nov 3, 2016

Thanks.

@jackmerrill

This comment has been minimized.

Copy link

@jackmerrill jackmerrill commented Dec 20, 2016

Doesn't Work. i do wget in Git Bash, and it says command not founcd.

@jvaughn575

This comment has been minimized.

Copy link

@jvaughn575 jvaughn575 commented Jan 6, 2017

It does work, but the function is called wget64, and not wget.

@NickRoux

This comment has been minimized.

Copy link

@NickRoux NickRoux commented Jan 9, 2017

It does work. A mistake that I initially made was to put the .exe into C:\Program Files\Git\bin instead of C:\Program Files\Git\mingw64\bin\

@dlaufer

This comment has been minimized.

Copy link

@dlaufer dlaufer commented Jan 26, 2017

Change the file in bin from "wget64.exe" to "wget.exe" and it will work with just wget.

@gatherKnowledge

This comment has been minimized.

Copy link

@gatherKnowledge gatherKnowledge commented Jan 31, 2017

thanks, It works.
My mistake also was the same that NickRoux did

@kennethy

This comment has been minimized.

Copy link

@kennethy kennethy commented Feb 10, 2017

thanks!

@evanwill

This comment has been minimized.

Copy link
Owner Author

@evanwill evanwill commented Mar 5, 2017

thanks for the comments-- yes, I rename the binaries to the standard names so that the standard commands work. It is just looks for a program named the same as the command in the mingw64/bin directory. Sometimes the tricky part is finding the mingw64 directory depending on how your Windows is set up. Look in C:\Program Files\Git\ or C:\Users\name\AppData\Local\Programs\Git\mingw64.

@hjkaria

This comment has been minimized.

Copy link

@hjkaria hjkaria commented Mar 7, 2017

Thanks!

@JohnTian

This comment has been minimized.

Copy link

@JohnTian JohnTian commented Mar 15, 2017

Thanks a lot !

@FredLackeyOfficial

This comment has been minimized.

Copy link

@FredLackeyOfficial FredLackeyOfficial commented Apr 27, 2017

Really appreciated. Worked perfectly. Thank you.

@nirvana-msu

This comment has been minimized.

Copy link

@nirvana-msu nirvana-msu commented May 28, 2017

Thanks! In my case the files just needed to go to C:\Program Files (x86)\Git; there's no mingw64 directory.

@eacton

This comment has been minimized.

Copy link

@eacton eacton commented Jun 1, 2017

Thanks! That makes Windows life slightly less painful.

@RebekahPerkins

This comment has been minimized.

Copy link

@RebekahPerkins RebekahPerkins commented Jun 21, 2017

This is very helpful, thanks so much. I never would have figured this out without this post

@tarunparmar

This comment has been minimized.

Copy link

@tarunparmar tarunparmar commented Jul 4, 2017

make did work! but then got stuck at g++: command not found...

is there anyway to have a standalone version of it (by not installing something)... its an admin protected laptop so i cant install anything.

@evanwill

This comment has been minimized.

Copy link
Owner Author

@evanwill evanwill commented Jul 21, 2017

@tarunparmar a good portable alternative is Cmder (which is actually a bit better than Git Bash alone), here are my notes: https://evanwill.github.io/_drafts/notes/cmdr.html

(I will add a note to the gist too)

but Make has lots of dependencies depending on what you are building, so getting that to work portably is much more challenging... not sure.

@dejanljevar

This comment has been minimized.

Copy link

@dejanljevar dejanljevar commented Aug 29, 2017

Thanks @evanwill , this is working :)

@Agusti7a

This comment has been minimized.

Copy link

@Agusti7a Agusti7a commented Sep 2, 2017

How to install python on git bash, i have try any methond on google, that not solve problem

@KoSz05

This comment has been minimized.

Copy link

@KoSz05 KoSz05 commented Oct 5, 2017

Thansk a lot , I was strugglin 2 hours till I found I succeeded with your hint.

@gjones604

This comment has been minimized.

Copy link

@gjones604 gjones604 commented Oct 23, 2017

Moved the 64bit exe from downloads to C:\Program Files\Git\mingw64\bin and renamed to wget.exe, works great!

@manisiripella

This comment has been minimized.

Copy link

@manisiripella manisiripella commented Oct 30, 2017

Thanks.

@kylechoo333

This comment has been minimized.

Copy link

@kylechoo333 kylechoo333 commented Nov 1, 2017

how about detect command? Is there any other way than keep adding command to it?
Thanks

@kmashint

This comment has been minimized.

Copy link

@kmashint kmashint commented Nov 22, 2017

👍 worked for my use case.

@snowman

This comment has been minimized.

Copy link

@snowman snowman commented Nov 22, 2017

Thanks, i'll give it a try.

Pretty good, works for me. But now i have a question, how do i install rename command in my git bash. plz help

@WillerAlbuquerque

This comment has been minimized.

Copy link

@WillerAlbuquerque WillerAlbuquerque commented Nov 23, 2017

I'm trying to use the command "more" but it doesn't works. What's wrong?

@gopik19

This comment has been minimized.

Copy link

@gopik19 gopik19 commented Dec 7, 2017

Did all the changes suggested, (including path changes & content copy etc for make) Unfortunately make does not work for me. This is the error I got
. /usr/bin/sh: C:/Program: No such file or directory
make: *** [Makefile:106: rel_inets_win] Error 127
I am trying to prepare the nitrogen erlang with make i.e make_inets_win (from https://github.com/nitrogen/nitrogen/blob/master/rel/overlay/win/README.md) and it fails. Any help will bless you. Thanks - GK

@davidsaada

This comment has been minimized.

Copy link

@davidsaada davidsaada commented Jan 13, 2018

My Symantec AV prevents make.exe from running due to WS.Reputation.1 error. As it's my company's AV, I can't disable this feature. Anyone here with a workaround?

@rdebath

This comment has been minimized.

Copy link

@rdebath rdebath commented Jan 16, 2018

For WS.Reputation.1 report a false positive, keep doing it. It's a dumb "detection" method that basically means "be scared of files you haven't seen before".

For a quick workaround you have to kill the AV on the relevant directories so you can get some work done or do everything in a VM.

@peterjc

This comment has been minimized.

Copy link

@peterjc peterjc commented Mar 3, 2018

@gopik19 that looks like a problem due to a space in a path name (allowed and common on Windows, rare and a bad idea on Linux) which has not been escaped or wrapped in quotes.

@billxc

This comment has been minimized.

Copy link

@billxc billxc commented Mar 16, 2018

Thanks! It helps a lot.

@vinod-philip

This comment has been minimized.

Copy link

@vinod-philip vinod-philip commented Mar 28, 2018

thanks it did work

@lumadev

This comment has been minimized.

Copy link

@lumadev lumadev commented Apr 2, 2018

Thanks! Now I can use wget in my Git Bash :)

@ivan-yosifov

This comment has been minimized.

Copy link

@ivan-yosifov ivan-yosifov commented Apr 11, 2018

Thank you! You solved my problem.

@Simon-L

This comment has been minimized.

Copy link

@Simon-L Simon-L commented Apr 12, 2018

I am using Cmder which I recommend! It comes in a flavour that has git-for-windows prebundled, it is still missing some other utilities that are nice to have.
My question is:
Could it be possible to have a nice way of adding arbitrary utilities to Git Bash?
Maybe using something like cygwin or apt-cyg, that would make it super easy!

@tsrimahesh

This comment has been minimized.

Copy link

@tsrimahesh tsrimahesh commented Apr 17, 2018

Thanks

@RichardTMiles

This comment has been minimized.

Copy link

@RichardTMiles RichardTMiles commented Jun 5, 2018

I know this is old, but the quickest way to do this is through the windows package manager https://chocolatey.org/

after having that the command to install is "choco install make"

@aasharma90

This comment has been minimized.

Copy link

@aasharma90 aasharma90 commented Jun 20, 2018

Thanks! It solved for me too!

@gleefeng

This comment has been minimized.

Copy link

@gleefeng gleefeng commented Jun 25, 2018

wonderful!

@bdjunayed

This comment has been minimized.

Copy link

@bdjunayed bdjunayed commented Jun 29, 2018

Thanks!

@charmgil

This comment has been minimized.

Copy link

@charmgil charmgil commented Jul 25, 2018

This is very helpful. Thanks!

@OuyangHu

This comment has been minimized.

Copy link

@OuyangHu OuyangHu commented Sep 30, 2018

thanks:)

@hamdimiled

This comment has been minimized.

Copy link

@hamdimiled hamdimiled commented Oct 2, 2018

thanks amigo

@kesarawimal

This comment has been minimized.

Copy link

@kesarawimal kesarawimal commented Oct 7, 2018

Thanks, buddy 🥇
💯 Working

@mengyu2015

This comment has been minimized.

Copy link

@mengyu2015 mengyu2015 commented Dec 8, 2018

谢谢

@praneel-gavali

This comment has been minimized.

Copy link

@praneel-gavali praneel-gavali commented Dec 16, 2018

Thanks!

@aimirza

This comment has been minimized.

Copy link

@aimirza aimirza commented Dec 26, 2018

I know this is old, but the quickest way to do this is through the windows package manager https://chocolatey.org/

after having that the command to install is "choco install make"

Thanks!!

@Syarujianai

This comment has been minimized.

Copy link

@Syarujianai Syarujianai commented Dec 27, 2018

Thanks!

@DANIELCARRION09

This comment has been minimized.

Copy link

@DANIELCARRION09 DANIELCARRION09 commented Jan 17, 2019

Please, how could I use "make" in windows console , i have a project with cmake and make for to run in visual Studio

@deanvlue

This comment has been minimized.

Copy link

@deanvlue deanvlue commented Jan 24, 2019

This has been really helpful! Bookmarked

@amnonkhen

This comment has been minimized.

Copy link

@amnonkhen amnonkhen commented Feb 11, 2019

Thanks. You could also add the watch utility.

@daguro

This comment has been minimized.

Copy link

@daguro daguro commented Feb 21, 2019

You can also install the git-sdk https://github.com/git-for-windows/build-extra/releases/tag/git-sdk-1.0.7

There are a lot of commands there. It will install in your file system root, eg, c:/git-sdk-64. You can copy any program you need from there to C:\Program\ Files\Git.

Not the best solution to be sure. I'm not a windows person, and I don't know how to install the sdk on top of the Git for Windows installation.

@enceladus181

This comment has been minimized.

Copy link

@enceladus181 enceladus181 commented May 3, 2019

Thanks, man! It really helped

@MamtaVenugopal

This comment has been minimized.

Copy link

@MamtaVenugopal MamtaVenugopal commented Jul 14, 2019

Screenshot (133)

@MamtaVenugopal

This comment has been minimized.

Copy link

@MamtaVenugopal 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

This comment has been minimized.

Copy link

@gutruaircraft 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

This comment has been minimized.

Copy link

@Patsjemoe Patsjemoe commented Aug 3, 2019

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

@adamcanray

This comment has been minimized.

Copy link

@adamcanray adamcanray commented Oct 7, 2019

BIG Thanks!!

@kal-9

This comment has been minimized.

Copy link

@kal-9 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

This comment has been minimized.

Copy link

@KeilChris KeilChris commented Dec 18, 2019

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

@DheerajArora5

This comment has been minimized.

Copy link

@DheerajArora5 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

This comment has been minimized.

Copy link

@Phartheben Phartheben commented Jan 20, 2020

Thanks, it still works!

@OmamaElrefaei

This comment has been minimized.

Copy link

@OmamaElrefaei OmamaElrefaei commented Jan 26, 2020

Thanks, it was helpful.

@santiagotoledo91

This comment has been minimized.

Copy link

@santiagotoledo91 santiagotoledo91 commented Jan 28, 2020

Thank you!!!

@StephenHosking

This comment has been minimized.

Copy link

@StephenHosking 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

This comment has been minimized.

Copy link

@volkov-maxim volkov-maxim commented Mar 3, 2020

Thank you a lot!

@hluu5

This comment has been minimized.

Copy link

@hluu5 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

This comment has been minimized.

Copy link

@scozma scozma commented Mar 23, 2020

Thank you!

@paalped

This comment has been minimized.

Copy link

@paalped 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

This comment has been minimized.

Copy link

@Whisper94 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

This comment has been minimized.

Copy link

@Moriarty16 Moriarty16 commented Aug 7, 2020

wget works well, thanks mate.

@lpossberg

This comment has been minimized.

Copy link

@lpossberg lpossberg commented Sep 16, 2020

Works! Super happy, thanks!

@drg-developer-2

This comment has been minimized.

Copy link

@drg-developer-2 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

This comment has been minimized.

Copy link

@NaViGatorFL 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

This comment has been minimized.

Copy link

@drg-developer-2 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

This comment has been minimized.

Copy link
Owner Author

@evanwill 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

This comment has been minimized.

Copy link

@drg-developer-2 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.