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, check my notes on Cygwin or Cmder.

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

  • 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!

  • 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 commented Nov 3, 2016

Thanks.

@jackmerrill

This comment has been minimized.

Copy link

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 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 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 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 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 commented Feb 10, 2017

thanks!

@evanwill

This comment has been minimized.

Copy link
Owner Author

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 commented Mar 7, 2017

Thanks!

@JohnTian

This comment has been minimized.

Copy link

JohnTian commented Mar 15, 2017

Thanks a lot !

@FredLackeyOfficial

This comment has been minimized.

Copy link

FredLackeyOfficial commented Apr 27, 2017

Really appreciated. Worked perfectly. Thank you.

@nirvana-msu

This comment has been minimized.

Copy link

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 commented Jun 1, 2017

Thanks! That makes Windows life slightly less painful.

@RebekahPerkins

This comment has been minimized.

Copy link

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 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 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 commented Aug 29, 2017

Thanks @evanwill , this is working :)

@Agusti7a

This comment has been minimized.

Copy link

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 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 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 commented Oct 30, 2017

Thanks.

@kylechoo333

This comment has been minimized.

Copy link

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 commented Nov 22, 2017

👍 worked for my use case.

@snowman

This comment has been minimized.

Copy link

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 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 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 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 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 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 commented Mar 16, 2018

Thanks! It helps a lot.

@vinod-philip

This comment has been minimized.

Copy link

vinod-philip commented Mar 28, 2018

thanks it did work

@lumadev

This comment has been minimized.

Copy link

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 commented Apr 11, 2018

Thank you! You solved my problem.

@Simon-L

This comment has been minimized.

Copy link

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 commented Apr 17, 2018

Thanks

@RichardTMiles

This comment has been minimized.

Copy link

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 commented Jun 20, 2018

Thanks! It solved for me too!

@gleefeng

This comment has been minimized.

Copy link

gleefeng commented Jun 25, 2018

wonderful!

@bdjunayed

This comment has been minimized.

Copy link

bdjunayed commented Jun 29, 2018

Thanks!

@charmgil

This comment has been minimized.

Copy link

charmgil commented Jul 25, 2018

This is very helpful. Thanks!

@OuyangHu

This comment has been minimized.

Copy link

OuyangHu commented Sep 30, 2018

thanks:)

@hamdimiled

This comment has been minimized.

Copy link

hamdimiled commented Oct 2, 2018

thanks amigo

@kesarawimal

This comment has been minimized.

Copy link

kesarawimal commented Oct 7, 2018

Thanks, buddy 🥇
💯 Working

@mengyu2015

This comment has been minimized.

Copy link

mengyu2015 commented Dec 8, 2018

谢谢

@praneel-gavali

This comment has been minimized.

Copy link

praneel-gavali commented Dec 16, 2018

Thanks!

@aimirza

This comment has been minimized.

Copy link

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 commented Dec 27, 2018

Thanks!

@DANIELCARRION09

This comment has been minimized.

Copy link

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 commented Jan 24, 2019

This has been really helpful! Bookmarked

@amnonkhen

This comment has been minimized.

Copy link

amnonkhen commented Feb 11, 2019

Thanks. You could also add the watch utility.

@daguro

This comment has been minimized.

Copy link

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 commented May 3, 2019

Thanks, man! It really helped

@MamtaVenugopal

This comment has been minimized.

Copy link

MamtaVenugopal commented Jul 14, 2019

Screenshot (133)

@MamtaVenugopal

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link

adamcanray commented Oct 7, 2019

BIG Thanks!!

@kal-9

This comment has been minimized.

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)

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.