1

Clarification:

So my question is rather general and doesn't address a specific tool, however, my issue came as a consequence of the need to remove the tool jq. I would appreciate a more generic approach to address all tools but if not possible, then specifically for jq would be appreciated.

The background:

I installed the jq tool using git-bash on Windows without a package manager (e.g., Chocolatey) by using curl -L -o /usr/bin/jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe

This added jq.exe to the folder C:\Program Files\Git\usr\bin

I created a script that does this installation for my team, but we need to erase this for various reasons. I don't want to tell every team member to go to that folder and erase the jq.exe file. Nor do I want to write a script that erases the exe file because I am not sure if erasing the exe file would constitute a proper uninstallation, so perhaps a solution that would involve a more comprehensive approach would be preferable.

The Question:

So is there a way to erase this tool (or any other tool for that matter that was installed in a similar way via git-bash) via the command line (so I could write a script for it) that would work for any user regardless of where they installed their Git folder?

1 Answers1

1

It depends.

When you download a binary (.exe) using curl (or wget, or even your browser), there are multiple ways that the binary might work, and resulting multiple ways that it might need to be uninstalled.

As mentioned in the comments, jq.exe is a single binary that doesn't create any configuration data by default. So deleting it will be sufficient.

However, it's entirely possible for you to curl/download a binary that is:

  • A Windows installer: In this case, the first time you run the .exe, its files will be installed via the normal Windows installation method. Uninstalling would be done through the Windows Add or remove programs settings page.

  • A self-extracting archive: Some applications will extract the files contained inside the download. The files will be located in either the current directory or a newly created subdirectory. In this case, deleting the files in the directory will be sufficient.

    For this reason, it's best to place the download in a directory of its own before executing, so that you can easily identify which files were created and need to be removed.

  • A single-binary that creates configuration data the first time it is run: Some applications will automatically create configuration data in a known location the first time they are run. Nushell (nu) for instance, is one of these. It would be entirely possible to download just the nu binary, and the first time it is executed, configuration files will be created in your home directory. In this case, to completely remove the files, you'll probably need to refer to the documentation or ask the developer.

  • A self-extracting source archive: I haven't seen this in a long time (honestly, if ever, in this exact form - It's a bit of a pathologic case the way I'm describing it here), but it would be possible for the payload of a self-extracting archive to be the source code for an application that needs to be built/compiled, usually with something like make install (and a number of build dependencies). Some developers will include a make uninstall, but others will just require that you "use the source, Luke" and determine which files you need to remove.

And these are just .exe cases. As also mentioned in the comments, if you weren't using Git Bash here (perhaps Windows Subsystem for Linux), you could curl an application package that would then be installed by a package manager. In that case, the package manager would also be used to remove the application.

NotTheDr01ds
  • 28,025