soimort / translate-shell

:speech_balloon: Command-line translator using Google Translate, Bing Translator, Yandex.Translate, etc.
https://www.soimort.org/translate-shell
The Unlicense
6.94k stars 391 forks source link

When running Trans in the windows10 Git bash app , "sh: hexdump: command not found" #379

Closed huangjiaqi1997 closed 3 years ago

huangjiaqi1997 commented 3 years ago
$ trans vorto
sh: hexdump: command not found
$ trans -V
Translate Shell       0.9.6.12-git:9bb510b

platform              MINGW64_NT-10.0-18363
terminal type         xterm
bi-di emulator        [N/A]
gawk (GNU Awk)        5.0.0
fribidi (GNU FriBidi) [NOT INSTALLED]
audio player          [NOT INSTALLED]
terminal pager        less
web browser           xdg-open
user locale           en_US.UTF-8 (English)
home language         en
source language       auto
target language       en
translation engine    google
proxy                 [NONE]
user-agent            Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36
ip version            [DEFAULT]
theme                 default
init file             [NONE]

Report bugs to:       https://github.com/soimort/translate-shell/issues
soimort commented 3 years ago

Unfortunately Windows 10's bash distribution does not come with an out-of-the-box equivalent for hexdump. There are four possible solutions to make it work on Windows:

  1. If you're using MSYS2, just install the util-linux package.
  2. If you're using Cygwin, just install the util-linux package.
  3. if you can't install util-linux through a package manager: Download a pre-built hexdump for Windows and put it into your PATH, e.g., from https://www.di-mgt.com.au/hexdump-for-windows.html.
  4. If none of the above works, compile and install the hexdump utility manually, using https://github.com/wahern/hexdump
soimort commented 3 years ago

Oh, I just realized that you're on Git bash for Windows. Then you should be able to install it via pacman -S util-linux directly; )

gorrioncillo commented 3 years ago

Sorry to write this here but in case someone is looking for some help on how to get this on windows 10 using git bash.

First you have to clone this repo. Second download the util-linux for MSYS2, on the previous post, and decompress all the .exe that are on the folder /bin and put on Program Files/Git/user/bin (double check for the hexdump.exe) Then just just use: gawk -f translate.awk -- Bonjour

Note, please make sure you have gawk greater than 4.0, I use version 5.0 Now it is just to put the repo somewhere and make an alias to use in a more comfortable way.

EDIT 10-21-2021: You can just download de release file and the hexdump.exe, move the file to the same folder inside git (Program File/Git/user/bin). Tested on git version 2.33.0.windows.2. YOU DON'T need the alias I showed before