add tar/gzip to windows command line - windows

As the title says - anyone know of a method to add tar/gzip to the command line in Windows? I've installed Cygwin - but don't know if I have to add something to the PATH env variable to get tar as a cmd option

The method I've used to solve this is to install Cygwin then place the path to the bin directory in the PATH variable.

9 years later (2019), a more modern option is to uncompress the latest Git for Windows (like PortableGit-2.17.0-64-bit.7z.exe).
It comes with 250+ linux command compiled for Windows, including tar and gzip.
No Cygwin needed.
But an even more recent option is the Command Line in Windows 10 version 1803: it includes a native tar and curl, right from your regular CMD.
(not gzip though). See announcement.
C:\Users\vonc>C:\Windows\System32\tar.exe --version
bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.5.f-ipp
Nothing to install!

You can install archiver instead of adding command in Windows cmd.exe,
There only 10 step to install and create .tar.gz file:
1. Open: https://www.win-rar.com/download.html or https://www.7-zip.org/download.html
2. Download Winrar Installer.
3. Open Winrar Installer.
4. Click "Agree" on Agreement.
5. Install Winrar.
6. Wait until Winrar fully installed in your computer.
7. Open file you want to compress with .gz
8. Right click the file.
9. Click "Add to Archive", and
10. Done.
But, if you still want to add command in Windows cmd.exe you can use that Cygwin. Tutorial link: https://www.youtube.com/watch?v=Rb8qtbXGA6I

Install UnxUtils - it's a set of GNU utilities ported to Windows, sort of like Cygwin but they also work outside the Cygwin environment.

Related

How to install and use "make" in Windows?

I'm following the instructions of someone whose repository I cloned to my machine. I want to use the make command as part of setting up the code environment, but I'm using Windows. I searched online, but I could only find a make.exe file, a make-4.1.tar.gz file (I don't know what to do with it next) and instructions for how to download MinGW (for GNU; but after installing it I didn't find any mention of "make").
How do I use make in Windows without a GNU compiler or related packages?
make is a GNU command so the only way you can get it on Windows is installing a Windows version like the one provided by GNUWin32. Anyway, there are several options for getting that:
The most simple choice is using Chocolatey. First you need to install this package manager. Once installed you simlpy need to install make (you may need to run it in an elevated/admin command prompt) :
choco install make
Other recommended option is installing a Windows Subsystem for Linux (WSL/WSL2), so you'll have a Linux distribution of your choice embedded in Windows 10 where you'll be able to install make, gccand all the tools you need to build C programs.
For older Windows versions (MS Windows 2000 / XP / 2003 / Vista / 2008 / 7 with msvcrt.dll) you can use GnuWin32.
An outdated alternative was MinGw, but the project seems to be abandoned so it's better to go for one of the previous choices.
GNU make is available on chocolatey.
Install chocolatey from here.
Then, choco install make.
Now you will be able to use Make on windows.
I've tried using it on MinGW, but it should work on CMD as well.
The accepted answer is a bad idea in general because the manually created make.exe will stick around and can potentially cause unexpected problems. It actually breaks RubyInstaller: https://github.com/oneclick/rubyinstaller2/issues/105
An alternative is installing make via Chocolatey (as pointed out by #Vasantha Ganesh K)
Another alternative is installing MSYS2 from Chocolatey and using make from C:\tools\msys64\usr\bin. If make isn't installed automatically with MSYS2 you need to install it manually via pacman -S make (as pointed out by #Thad Guidry and #Luke).
If you're using Windows 10, it is built into the Linux subsystem feature. Just launch a Bash prompt (press the Windows key, then type bash and choose "Bash on Ubuntu on Windows"), cd to the directory you want to make and type make.
FWIW, the Windows drives are found in /mnt, e.g. C:\ drive is /mnt/c in Bash.
If Bash isn't available from your start menu, here are instructions for turning on that Windows feature (64-bit Windows only):
https://learn.microsoft.com/en-us/windows/wsl/install-win10
Download make.exe from their official site GnuWin32
In the Download session, click
Complete package, except sources.
Follow the installation instructions.
Once finished, add the <installation directory>/bin/ to the PATH variable.
Now you will be able to use make in cmd.
Install Msys2 http://www.msys2.org
Follow installation instructions
Install make with $ pacman -S make gettext base-devel
Add C:\msys64\usr\bin\ to your path
On windows 10 or 11, you can run the command winget install GnuWin32.Make in the command line or powershell to quickly install it. Than you can use the command cmake.
There is no need to install choco anymore.
The chances are that besides GNU make, you'll also need many of the coreutils. Touch, rm, cp, sed, test, tee, echo and the like. The build system might require bash features, if for nothing else, it's popular to create temp file names from the process ID ($$$$). That won't work without bash. You can get everything with the popular POSIX emulators for Windows:
Cygwin (http://www.cygwin.org/) Probably the most popular one and the most compatible with POSIX. Has some difficulties with Windows paths and it's slow.
GNUWin (http://gnuwin32.sourceforge.net/) It was good and fast but now abandoned. No bash provided, but it's possible to use it from other packages.
ezwinports (https://sourceforge.net/projects/ezwinports) My current favorite. Fast and works well. There is no bash provided with it, that can be a problem for some build systems. It's possible to use make from ezwinports and bash from Cygwin or MSYS2 as a workaround.
MSYS 1.19 abandoned. Worked well but featured very old make (3.86 or so)
MSYS2 (https://www.msys2.org/) Works well, second fastest solution after ezwinports. Good quality, package manager (pacman), all tooling available. I'd recommend this one.
MinGW abandoned? There was usually MSYS 1.19 bundled with MinGW packages, that contained an old make.exe. Use mingw32-make.exe from the package, that's more up to date.
Note that you might not be able to select your environment. If the build system was created for Cygwin, it might not work in other environments without modifications (The make language is the same, but escaping, path conversion are working differently, $(realpath) fails on Windows paths, DOS bat files are started as shell scripts and many similar issues). If it's from Linux, you might need to use a real Linux or WSL.
If the compiler is running on Linux, there is no point in installing make for Windows, because you'll have to run both make and the compiler on Linux. In the same way, if the compiler is running on Windows, WSL won't help, because in that environment you can only execute Linux tools, not Windows executables. It's a bit tricky!
I could suggest a step by step approach.
Visit GNUwin
Download the Setup Program
Follow the instructions and install GNUWin. You should pay attention to the directory where your application is being installed. (You will need it later1)
Follow these instructions and add make to your environment variables. As I told you before, now it is time to know where your application was installed.
FYI: The default directory is C:\Program Files (x86)\GnuWin32\.
Now, update the PATH to include the bin directory of the newly installed program.
A typical example of what one might add to the path is: ...;C:\Program Files (x86)\GnuWin32\bin
Another alternative is if you already installed minGW and added the bin folder the to Path environment variable, you can use "mingw32-make" instead of "make".
You can also create a symlink from "make" to "mingw32-make", or copying and changing the name of the file. I would not recommend the options before, they will work until you do changes on the minGW.
I once had the same problem. But I am surprised not to find one particular solution here.
Installation from GnuWin32 or via winget are good and easy options. But I only found make 3.8.1 there. This version lacks the very important option -O, which handles the output correctly when compiling multithreaded.
choco appears to offer make 4.3, currently. So one could expect recent versions there.
But there is also the option of self compiling. And if you have to install make, which is used for compiling, this should be a valid option.
head to https://www.gnu.org/software/make/ and download a version of your liking
unpack the tar.gz files (use 7zip and unpack the file twice to retrieve the actual content)
navigate to the created directory
open command prompt in that directory
run build_w32.bat gcc This will start the compilation with the gcc compiler, which you would need to install in advance. When running build_w32.bat without any option they try to use the MSVC compiler. Sidenote: I found it surprising that gnu does not use gcc as default but MSVC :-)
ignore the warnings created during compilation. The result should still be fine
retrieve your fresh gnumake.exe from the directoy GccRel (when compiled with gcc)
put this file somewhere where you like and rename to make.exe
add the location to the system variable %PATH%
As others have noted: This manual installation might cause conflicts if you have various make versions installed by other programs as well.
You can also install scoop, then run:
scoop install make
One solution that may helpful if you want to use the command line emulator cmder. You can install the package installer chocately. First we install chocately in windows command prompt using the following line:
#"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
refreshenv
After chocolatey is installed the choco command can be used to install make. Once installed, you will need add an alias to /cmder/config/user_aliases.cmd. The following line should be added:
make="path_to_chocolatey\chocolatey\bin\make.exe" $*
Make will then operate in the cmder environment.
Install npm
install Node
Install Make
node install make up
node install make
If above commands displays any error then install Chocolatey(choco)
Open cmd and copy and paste the below command (command copied from chocolatey URL)
#"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

Cygwin Openssl uninstall

I'm a complete newbie on cygwin, it was placed on our server to configure ssh or openssl, not by me :-) .
server: windows 2003 SP2
cygwin: (cannot find version, but it says GNU bash, version 4.1.10(4)-release (i686-pc-cygwin))
OpenSSL-Win32: version 1.0.2a
In the cygwin terminal I see two things that disturb and confuse me:
If I open the cygwin terminal I can type
>$ openssl
>cygwin warning: MS-DOS style path detected: C:\OpenSSL-Win32\bin\openssl.cfg ...(etc)
So the cygwin can see the other openssl install. I would be happy with that if I would not get the following:
>OpenSSL> version
>OpenSSL 0.9.8t 18 Jan 2012
So, there seems to be be 2 versions of openssl installed, even though I think that this 0.9.8t version doesn't seem to do anything.
How do I uninstall this openSSL version?
Thanks in advance!
To uninstall any package from Cygwin, run setup.exe (which you should already have), and on the package selection screen you should search for "openssl". After that you should click the round arrow icon for the packages until it says "Uninstall", then continue.
Anyway the warning indicates that you run the win32 version, and not the cygwin package. To make sure of that, you should run this command: which openssl. This will print the path to the executable. If this path is not what you want, then use an absolute path at the command line. E.g: /cygdrive/c/path_to_openssl/openssl.exe.

I want to view a .ps file through Ghostscript 9.05 command prompt

I have a file abc.ps on my desktop. I have installed Ghostscript 9.05 on my machine and I want to view my abc.ps file using the command line.
GS>?????
What command should I write here. I am working on Windows 7.
Location of exe file: C:\Program Files\gs\gs9.05\bin
From the Ghostscript documentation:
GS> (c:/gs3.53/example.ps)
Just looks like you use forward slashes instead of back slashes. For example, if your Windows username is Ankit, you'd enter:
GS> (c:/Users/Ankit/Desktop/abc.ps)
You can avoid the interactive GS> commandprompt by running the command like this:
gswin32c.exe -sDEVICE=display c:/Users/Ankit/Desktop/abc.ps
Download and install Ghostview after installing Ghostscript, it is a GUI interface for Ghostscript:
http://pages.cs.wisc.edu/~ghost/gsview/get50.htm
Note: Be sure you download the same architecture. I.e. if you downloaded and installed 64 bit ghostscript, make sure you also download and install 64 bit Ghostview.

ImageMagick - How to Build a 32-bit Mac version for MAMP?

This is a pretty straight-forward question: I have an older INTEL Mac (32-bit) and I need to build a 32-bit version of ImageMagick.
I've seen some people playing around with options during the binary install, but I can't seem to find any reliable information about how to do this!
NOTE: ImageMagick gives out a 64-bit version of the binaries for Mac OS X on their webpage, but I'm not sure if this can be hacked into a 32-bit version during compiling?
THANK YOU - I'm really stuck on this!
The problem was ImageMagick's un-intuitive webpage that made it a little hard to figure out how to proceed - I finally found the binaries on their page and installed following these directions:
Intro:
If you have an older INTEL MacBook - it might have a 32-bit processor. This is how to compile ImageMagick (Mac OS X version) as a 32-bit program using the ImageMagick binary files - NOT USING MACPORTS!.
To find out what processor you have, i.e. 32-bit or 64-bit, look here:
http://support.apple.com/kb/ht3696
To install via MACPORTS look here:
http://xentek.net/articles/442/installing-imagemagick-and-imagick-via-macports/
My Computer:
This worked on my first-generation INTEL Macbook (you know - the white one with a Due Core processor).
OS:
I'm running OS X 10.6.4 (Snow Leopard)
INSTALL STEPS:
1. The trick is to ignore ImageMagick's pre-packed MAC OS X install package because it's compiled in a 64-bit version - we want a 32-bit version instead!
So, we need to get the UNIX binaries here: http://www.imagemagick.org/script/install-source.php#unix
Following the page's instructions, we download a file called ImageMagick.tar.gz. The ImageMagick group seemingly updates this link to point to the latest version.
The file is a compressed TAR file with the extension tar.gz. If you're using MAMP (like I am) then you might want to create a new file called "ImageMagick" (without the quotation marks "") in this folder: /Applications/MAMP/bin/. Normally we would install ImageMagick into this folder - however, because we're working from the binaries, a standard ./configure / make / make install pattern will simply default install ImageMagick into whatever path you have set up on your computer. In my case, my default path is the USR/LOCAL folder.
NOTE: if somebody wants to write here how to instead direct the ./configure options so that ImageMagick will install into a MAMP folder (or other folder) instead of the default path, that would be really helpful!
Well, back to the MAMP 32-bit install:
Place your recently-downloaded binary copy of ImageMagick in a new folder. I use a folder called SRC to keep all these intermediate copies of files in a place that I can later delete/clean when they are not necessary.
Next, expand the compressed file by opening your TERMINAL (look for the program in the "Utilities" folder).
With TERMINAL open, type the following:
cd path/to/the/ImageMagick/file #navigate to the folder where the file is saved
tar xvfz ImageMagick.tar.gz #expand the tar ball file
You should now see in the ImageMagick folder a new folder that you just expanded, called (for example) "ImageMagick-6.6.3" (NOTE: later versions of ImageMagick might have a different version number written at the end of this). Right now the folder would be called ImageMagick-6.6.3-2 ...
Move one level up into that folder.
To do so, type the following into TERMINAL:
cd ImageMagick-6.6.3-2 #replace the version number
Now you're going to run a standard .configure / make / make install pattern - your compiler/system should automatically configure the build to your 32-bit environment!
In terminal, you should be in the ImageMagick-6.6.3 file folder. Once there, run these commands:
sudo ./configure #I use SUDO here just in case your file permissions are messed up...
make #go get a cup of coffee
make install #go get another cup ...
HINT: text after the "#" is just my comments - just ignore the # and also the text on that line following the hash...
Make sure the "./configure" "MAKE" and "MAKE INSTALL" commands finish without errors - they should run just fine!
Then, you can run the standard ImageMagick test using your TERMINAL program:
Type this out to run the tests:
convert logo: logo.gif
identify logo.gif
display logo.gif
Wholla! You should see the ImageMagick logo pop up - meaning that ImageMagick is now installed on your 32-bit MAC OS X computer!
thx for this! to point configure to a different installation directory the syntax is:
./configure --prefix=NEW_PREFIX
where NEW_PREFIX should be set to the path of your mamp installation directory.

How to install pkg config in windows?

I am trying to do it, but all I can get is some source code that I don't know how to do deal with I downloaded from http://pkgconfig.freedesktop.org/releases/.
This is a step-by-step procedure to get pkg-config working on Windows, based on my experience, using the info from Oliver Zendel's comment.
I assume here that MinGW was installed to C:\MinGW. There were multiple versions of the packages available, and in each case I just downloaded the latest version.
go to http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/
download the file pkg-config_0.26-1_win32.zip
extract the file bin/pkg-config.exe to C:\MinGW\bin
download the file gettext-runtime_0.18.1.1-2_win32.zip
extract the file bin/intl.dll to C:\MinGW\bin
go to http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28
download the file glib_2.28.8-1_win32.zip
extract the file bin/libglib-2.0-0.dll to C:\MinGW\bin
Now CMake will be able to use pkg-config if it is configured to use MinGW.
Get the precompiled binaries from http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/
Download pkg-config and its depend libraries :
pkg-config_0.26-1_win32.zip
glib_2.28.8-1_win32.zip
gettext-runtime_0.18.1.1-2_win32.zip
A alternative without glib dependency is pkg-config-lite.
Extract pkg-config.exe from the archive and put it in your path.
Nowdays this package is available using chocolatey, then it could be installed with
choco install pkgconfiglite
I did this by installing Cygwin64 from this link https://www.cygwin.com/
Then - View Full, Search gcc and scroll down to find pkg-config.
Click on icon to select latest version.
This worked for me well.
I would like to extend the answer of #dzintars about the Cygwin version of pkg-config in that focus how should one use it properly with CMake, because I see various comments about CMake in this topic.
I have experienced many troubles with CMake + Cygwin's pkg-config and I want to share my experience how to avoid them.
1. The symlink C:/Cygwin64/bin/pkg-config -> pkgconf.exe does not work in Windows console.
It is not a native Windows .lnk symlink and it won't be callable in Windows console cmd.exe even if you add ".;" to your %PATHEXT% (see https://www.mail-archive.com/cygwin#cygwin.com/msg104088.html).
It won't work from CMake, because CMake calls pkg-config with the method execute_process() (FindPkgConfig.cmake) which opens a new cmd.exe.
Solution: Add -DPKG_CONFIG_EXECUTABLE=C:/Cygwin64/bin/pkgconf.exe to the CMake command line (or set it in CMakeLists.txt).
2. Cygwin's pkg-config recognizes only Cygwin paths in PKG_CONFIG_PATH (no Windows paths).
For example, on my system the .pc files are located in C:\Cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\lib\pkgconfig. The following three paths are valid, but only path C works in PKG_CONFIG_PATH:
A) c:/Cygwin64/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig -
does not work.
B) /c/cygdrive/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig -
does not work.
C) /usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig - works.
Solution: add .pc files location always as a Cygwin path into PKG_CONFIG_PATH.
3) CMake converts forward slashes to backslashes in PKG_CONFIG_PATH on Cygwin.
It happens due to the bug https://gitlab.kitware.com/cmake/cmake/-/issues/21629. It prevents using the workaround described in [2].
Solution: manually update the function _pkg_set_path_internal() in the file C:/Program Files/CMake/share/cmake-3.x/Modules/FindPkgConfig.cmake. Comment/remove the line:
file(TO_NATIVE_PATH "${_pkgconfig_path}" _pkgconfig_path)
4) CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH, CMAKE_APPBUNDLE_PATH have no effect on pkg-config in Cygwin.
Reason: the bug https://gitlab.kitware.com/cmake/cmake/-/issues/21775.
Solution: Use only PKG_CONFIG_PATH as an environment variable if you run CMake builds on Cygwin. Forget about CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH, CMAKE_APPBUNDLE_PATH.
Install mingw64 from https://sourceforge.net/projects/mingw-w64/. Avoid program files/(x86) folder for installation. Ex. c:/mingw-w64
Download pkg-config__win64.zip from here
Extract above zip file and copy paste all the files from pkg-config/bin folder to mingw-w64. In my case its 'C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin'
Now set path = C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin
taddaaa you are done.
If you find any security issue then follow steps as well
Search for windows defender security center in system
Navigate to apps & browser control> Exploit protection settings> Program setting> Click on '+add program customize'
Select add program by name
Enter program name: pkgconf.exe
OK
Now check all the settings and set it all the settings to off and apply.
Thats DONE!
Another place where you can get more updated binaries can be found at Fedora Build System site. Direct link to mingw-pkg-config package is: http://koji.fedoraproject.org/koji/buildinfo?buildID=354619
for w64-based computers you have to install mingw64. If pkg-config.exe is missing then, you can refer to http://ftp.acc.umu.se/pub/gnome/binaries/win64/dependencies/
Unzip and copy/merge pkg-config.exe into your C:\mingw-w64 installation, eg. into on my pc into C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin
In 2022 VS Code works with CMake & pkgconfig out of the box (add pkgconf && vcpkg-pkgconfig-get-modules to your vcpkg.json)
From: https://github.com/JoinMarket-Org/joinmarket/wiki/Installing-JoinMarket-on-Windows
This guide describes how to install JoinMarket and its dependencies (python, libsodium, secp256k1) on Windows.
Some or all of this may or may not work for all versions of Windows. Reports appreciated. It is not claimed to be in any way comprehensive. Verification of downloads are your own responsibility.
Install JoinMarket - go to https://github.com/JoinMarket-Org/joinmarket/releases and download the most recent release. Unzip it into any location you choose.
You will need to install MinGW from here or go to their website. After a few introductory screens, you will be shown a windows with some optional components that you have to choose; this basic setup is sufficient:
From "Basic Setup" in the left menu:
mingw-developer-toolkit
mingw32-base
mingw32-gcc-g++
msys-base
Once you have chosen these, choose "Update" from the main menu first item. These components will be installed into C:\MinGW\bin. Once that is complete, you should have this dll: libgcc_s_dw2-1.dll in that folder C:\MinGW\bin, along with a lot of other files; I'm mentioning this file explicitly, since it's needed specifically for libsecp256k1 to operate in this setup.
Next, you must make sure C:\MinGW\bin is added to your PATH variable. Here's one guide to how to do that; you must append ;C:\MinGW\bin to the end of the path before continuing.
Install Python from https://www.python.org/ftp/python/2.7.11/python-2.7.11.msi. Run the executable. Choose to install the feature Add python.exe to Path (it's the last option in the installer, off by default - switch it on) on local hard drive during installation; Python should then be installed in C:\Python27 (EXTRA NOTE: the most recent 2.7 installation linked here seems to install pip automatically, which is very useful for step 4)
Check that Python runs. Open a new command prompt as administrator by typing cmd.exe into the Start menu and pressing Ctrl+Shift+Enter. Type python and you should see something like:
Python 2.7.11 (default....
....
>>>
Exit the Python console with exit() or by pressing Ctrl+C. Now, make sure your version of pip is up to date: run the command: python -m pip install --upgrade pip.
Go to the directory C:\Python27\Lib\distutils and add a new file, called distutils.cfg. Inside it, put:
[build]
compiler=mingw32
Close and save the file.
Next, you need to install the dll for libnacl. First go to https://download.libsodium.org/libsodium/releases/ and choose the file libsodium-1.0.4-msvc.zip to download. Unzip anywhere, and then copy the file libsodium.dll from the directory \Win32\Release\v120\dynamic (do not use v140), and paste it into root joinmarket directory (the same directory where README.md lives). Then you need to address the Visual C++ 2013 runtime dependency. Do so by going to www.microsoft.com/en-us/download/details.aspx?id=40784 and clicking Download. Choose x86 even on a 64-bit system, and run the executable.
Note that after doing this, you must run pip install -r requirements-windows.txt from the Joinmarket root directory (where the README.md file is) and should not get an error message (this will install/check the python packages libnacl and secp256k1(-transient)).

Resources