148

Is there any apt-get-like program for use with Cygwin?

I've already tried cyg-apt, but when I try to run it I get this error:

cyg-apt: downloading: http://cygwin.mirrors.pair.com/setup-2.bz2 cyg-apt: downloading: http://cygwin.mirrors.pair.com/setup-2.ini cyg-apt: bad URL http://cygwin.mirrors.pair.com/setup-2.ini, exiting. 
5
  • The file is available in the source repository. Commented Mar 28, 2012 at 19:11
  • Is it possible to download from a different repo than cygwin? Actually, I need some linux-headers for a computer offline with linux but I need to download them on windows with an apt-get. Commented Dec 21, 2013 at 3:05
  • possible duplicate of How do I install cygwin components from the command line? Commented Feb 20, 2014 at 4:47
  • 3
    cyg-apt has the last update 5 year ago. Current repository structure is different. Therefore it won't work. Commented Apr 17, 2014 at 21:44
  • 3
    don't confuse cyg-apt with apt-cyg. The latter is much better (just remember the one that sounds most similar to apt-get is the good one). Commented Aug 30, 2017 at 20:49

7 Answers 7

144

Best I have ever used:

apt-cyg package manager

Sign up to request clarification or add additional context in comments.

5 Comments

apt-cyg orks really well. Just installed rsync, openssh, mc and others.
It can only install and remove packages, can't it? It's not possible to upgrade particular package or all packages to the newest version with apt-cyg. So it's nice, but useless since I have to use Cygwin's setup too. I would be pleased if I'm wrong.
apt-cyg update will update setup.ini etc, if anyone has issues without of date setup.ini
Are there any mirrors?
@CodeMonkey The repo is back up, along with it's competitor: Sage
107

You can do this using Cygwin’s setup.exe from Windows command line. Example:

cd C:\cygwin64 setup-x86_64 -q -P wget,tar,gawk,bzip2,subversion,vim 

For a more convenient installer, you may want to use the apt-cyg package manager. Its syntax is similar to apt-get, which is a plus. For this, follow the above steps and then use Cygwin Bash for the following steps:

wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg install apt-cyg /bin 

Now that apt-cyg is installed. Here are a few examples of installing some packages:

apt-cyg install nano apt-cyg install git apt-cyg install ca-certificates 

8 Comments

after doing above step apt-cyg for 64 bits gives exception /usr/local/bin/apt-cyg: line 1: $'\r': command not found /usr/local/bin/apt-cyg: line 3: $'\r': command not found /usr/local/bin/apt-cyg: line 19: $'\r': command not found /usr/local/bin/apt-cyg: line 21: $'\r': command not found /usr/local/bin/apt-cyg: line 27: syntax error near unexpected token ||' 'usr/local/bin/apt-cyg: line 27: || test "-$GAWK-" = "--"
@sagunms it worked charm! this was annoying issue until i found the solution. Thanks.
@Shahjahan Khan: It seems, that you broke line endings with some Windows text editor. Use Linux line endings (\n or LF or 0x0A), not Windows (\r\n or 0x0D 0x0A or CR LF).
hey.. how would i install gcc using that tool suppose i forgot to install the Devel packages while installing cygwin
Works for me! a
|
28

Update: you can read the more complex answer, which contains more methods and information.

There exists a couple of scripts, which can be used as simple package managers. But as far as I know, none of them allows you to upgrade packages, because it’s not an easy task on Windows since there is not possible to overwrite files in use. So you have to close all Cygwin instances first and then you can use Cygwin’s native setup.exe (which itself does the upgrade via “replace after reboot” method, when files are in use).


apt-cyg

The best one for me. Simply because it’s one of the most recent. It works correctly for both platforms - x86 and x86_64. There exists a lot of forks with some additional features. For example the kou1okada fork is one of improved versions.


Cygwin’s setup.exe

It has also command line mode. Moreover it allows you to upgrade all installed packages at once.

setup.exe-x86_64.exe -q --packages=bash,vim 

Example use:

setup.exe-x86_64.exe -q --packages="bash,vim"

You can create an alias for easier use, for example:

alias cyg-get="/cygdrive/d/path/to/cygwin/setup-x86_64.exe -q -P"

Then you can for example install the Vim package with:

cyg-get vim

Comments

19

you can always make a bash alias to setup*.exe files in $home/.bashrc

cygwin 32bit

alias cyg-get="/cygdrive/c/cygwin/setup-x86.exe -q -P" 

cygwin 64bit

alias cyg-get="/cygdrive/c/cygwin64/setup-x86_64.exe -q -P" 

now you can install packages with

cyg-get <package> 

Comments

7

This got it working for me:

curl https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg > \ apt-cyg && install apt-cyg /bin 

2 Comments

wget https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg && install apt-cyg /bin is another option if curl is missing
Also remember rm apt-cyg afterwards.
6

No. The only officially supported tool for downloading and updating Cygwin packages is the setup.exe file you used for the initial install, although that can be invoked with command line arguments to help the process.

From that same page:

The basic reason for not having a more full-featured package manager is that such a program would need full access to all of Cygwin's POSIX functionality. That is, however, difficult to provide in a Cygwin-free environment, such as exists on first installation. Additionally, Windows does not easily allow overwriting of in-use executables so installing a new version of the Cygwin DLL while a package manager is using the DLL is problematic.

1 Comment

Those were some good details on why this is not generally possible. Should be included in the cyg-get or apt-cyg docs.
-1

You can use Chocolatey to install cyg-get and then install your packages with it.

For example:

choco install cyg-get 

Then:

cyg-get install my-package 

3 Comments

Unfortunately this downloads Cygwin setup setup-x86_64.exe and installs Cygwin again, not just apt-cyg. I had to cancel the installation.
I think this didn't happen to me :/
Works well here. Easy to remember and searchable on chocolatey.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.