0

I am currently using vim editor on Git Bash terminal running in a Windows machine, but I want to switch over to Emacs editor. It is returning bash: emacs: command not found . Do I need to install the Emacs? If true, what command do I use, and what could be the general soulution?

2 Answers 2

2

I am currently using vim editor on Git Bash terminal running in a Windows machine,

So if you tell which to find your Vim, it will give you the right answer:

shynur@ASUS-TX2 MINGW64 /d
$ which vim
/usr/bin/vim

But what if you try to find Emacs?

shynur@ASUS-TX2 MINGW64 /d
$ which emacs
which: no emacs in (...)

A precompiled Git Bash on MS-Windows does not carry an Emacs, at least in your and my machines' environments.

What I did to solve it is to put the directory /path/to/emacs-28.2/bin/ into the PATH environment variable (so you should download Emacs first); now let's try again:

shynur@ASUS-TX2 MINGW64 /d
$ which emacs
/d/Progs/emacs-28.2/bin/emacs

shynur@ASUS-TX2 MINGW64 /d
$ emacs

shynur@ASUS-TX2 MINGW64 /d
$ 

It seems to work fine.
But note that, you cannot run emacs -nw on a Git Bash on MS-Windows because:

shynur@ASUS-TX2 MINGW64 /d
$ emacs -nw
emacs: standard input is not a tty
0

Thanks @Shynur for the insight. I have copied to the path environment environment variable, yet it give this error:

    LOFTDOT@Zuang-Ji MINGW64 ~
$ which emacs C:/Users/LOFTDOT/emacs/bin
which: no emacs in (/c/Users/LOFTDOT/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/LOFTDOT/bin:/c/Python311/Scripts

Running Emacs on git bash generates this:

LOFTDOT@Zuang-Ji MINGW64 ~
$ emacs
bash: emacs: command not found
3
  • No, you didn't add the /path/to/emacs-VERSION/bin/ to your environment variable PATH. which shows you the current value of PATH.
    – shynur
    Commented Mar 18, 2023 at 17:23
  • Thank you Shynur, I missed stuff on the path. It works fine now and here are the steps: (1). Download emacs from: gnu.org/software/emacs/download.html#nonfree (2). Open the installation directory of emacs and open the bin file and copy the directory path: C:\Program Filesxxx\Emacsscde\emacs-29.0.6675\bin (3). Right click on computer system and clcik Advanced System Settings to see the System Property dialog box (4). Click Environment Variables (5). Double click path under system variables (6). Click New and paste copied in step 2 (7). Click OK Commented Apr 1, 2023 at 15:14
  • Congratulations! A comment is volatile; feel free to modify my answer to make it more complete and better help others with the same problem.
    – shynur
    Commented Apr 1, 2023 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.