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.

DWiechert commented Nov 3, 2016

Thanks.

@yoshifan509

This comment has been minimized.

yoshifan509 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.

jvaughn575 commented Jan 6, 2017

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

@NickRoux

This comment has been minimized.

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.

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.

gatherKnowledge commented Jan 31, 2017

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

@kennethy

This comment has been minimized.

kennethy commented Feb 10, 2017

thanks!

@evanwill

This comment has been minimized.

Owner

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.

hjkaria commented Mar 7, 2017

Thanks!

@JohnTian

This comment has been minimized.

JohnTian commented Mar 15, 2017

Thanks a lot !

@FredLackeyOfficial

This comment has been minimized.

FredLackeyOfficial commented Apr 27, 2017

Really appreciated. Worked perfectly. Thank you.

@nirvana-msu

This comment has been minimized.

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.

eacton commented Jun 1, 2017

Thanks! That makes Windows life slightly less painful.

@RebekahPerkins

This comment has been minimized.

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.

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.

Owner

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.

dejanljevar commented Aug 29, 2017

Thanks @evanwill , this is working :)

@Agusti7a

This comment has been minimized.

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.

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.

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.

manisiripella commented Oct 30, 2017

Thanks.

@kylechoo333

This comment has been minimized.

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.

kmashint commented Nov 22, 2017

👍 worked for my use case.

@balalaXD

This comment has been minimized.

balalaXD 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.

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.

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.

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.

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.

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.

billxc commented Mar 16, 2018

Thanks! It helps a lot.

@vinod-philip

This comment has been minimized.

vinod-philip commented Mar 28, 2018

thanks it did work

@lumadev

This comment has been minimized.

lumadev commented Apr 2, 2018

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

@ivan-yosifov

This comment has been minimized.

ivan-yosifov commented Apr 11, 2018

Thank you! You solved my problem.

@Simon-L

This comment has been minimized.

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.

tsrimahesh commented Apr 17, 2018

Thanks

@RichardTMiles

This comment has been minimized.

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.

aasharma90 commented Jun 20, 2018

Thanks! It solved for me too!

@gleefeng

This comment has been minimized.

gleefeng commented Jun 25, 2018

wonderful!

@bdjunayed

This comment has been minimized.

bdjunayed commented Jun 29, 2018

Thanks!

@charmgil

This comment has been minimized.

charmgil commented Jul 25, 2018

This is very helpful. Thanks!

@OuyangHu

This comment has been minimized.

OuyangHu commented Sep 30, 2018

thanks:)

@hamdimiled

This comment has been minimized.

hamdimiled commented Oct 2, 2018

thanks amigo

@kesarawimal

This comment has been minimized.

kesarawimal commented Oct 7, 2018

Thanks, buddy 🥇
💯 Working

@mengyu2015

This comment has been minimized.

mengyu2015 commented Dec 8, 2018

谢谢

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