how to install apt-cyg for Cygwin?

Viewed 56436

taken form here - explaining how to install apt-cyg

Install apt-cyg

You may have heard of programs like apt-get (Ubuntu), yum/dnf (Fedora), pacman (Arch), or brew (Mac OS X)... .. .The analogous program for Cygwin is called apt-cyg.

Installing apt-cyg is simple. First, save this file: https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg . Then, use File Explorer to find the file in your Downloads folder and move it into C:\cygwin\bin. Then, open Cygwin and enter "chmod +x /bin/apt-cyg". This tells Cygwin that you want to be able to execute the apt-cyg command. Lastly, enter "apt-cyg mirror ftp://sourceware.org/pub/cygwin". This sets up apt-cyg to use the official repository when downloading programs.

Sounds simple enough. But i have an error.

This tutorial does not specify with what name and what extension to save that file.

I save it as apt-cyg.txt, and move it into C:\cygwin64\bin

This does not work. When running apt-cyg, I get the error: bad interpreter: No such file or directory

how to install apt-cyg for Cygwin? - error

My guess is that extension or filenames are bad. What name and extension should i use?

Are there any more steps to this process?

Note: I just installed cygwin on a windows 10. Please don't assume i have other tools already installed.

7 Answers

You install it like this:

1 - Make sure lynx is installed

2 - Run lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg

3 - Run install apt-cyg /bin

That's it!

The github repo of apt-cyg asks to install apt-cyg as follows:

lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin

(This requires lynx to be already installed in your cygwin. If you have not selected lynx package during installation of cygwin, you can rerun the setup at installation-path-to-cygwin\cygwin\setup\setup-x86_64.exe and then select lynx in its installation wizard.)

However, I was getting error while running above lynx command. Seems that being behind corporate proxy is an issue. And I was unable to figure it out how to configure the proxy for lynx.

So I simply went to github to access apt-cyg script here. I downloaded the script from browser, by navigating to above link, right clicking and then save as. Note that you have to save it without extension (that is, select "All Files" in "Save as type" drop down of "Save As" window, instead of "Text Document"), because browser may by default save it as text file (txt). If you have downloaded it as txt, you may change extension. Cut paste this file to path-tocygwin\cygwin\setup\bin.

Thats it!!! Now apt-cyg must be accessible from cygwin terminal.

Note:

Dont forget to set proxt path if you are running apt-cyg install behind corporate proxy:

export http_proxy=http://username:password@proxy-server-name:proxy-server-port
export https_proxy=http://username:password@proxy-server-name:proxy-server-port

For example:

export http_proxy=http://mahesh:password%40123@proxy.mycompany.com:8080
export https_proxy=http://mahesh:password%40123@proxy.mycompany.com:8080

Note @ in password should be replaced with %40.

Then you can install packages:

apt-cyg install gcc-core

Install Net packages with setup.exe, then use wget.exe https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg and install apt-cyg /bin as it was mentioned above.

Note to self: I am lazy and I prefer to be able to type apt-get... Here is a copy and paste shell command to automate this.

$ wget 'https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg' -O \
       /usr/bin/apt-cyg && 
       chmod 755 /usr/bin/apt-get; \
  test -f /usr/bin/apt-get || ( 
       curl 'https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg' -o \
           /usr/bin/apt-get && 
       chmod 755 /usr/bin/apt-cyg ); \
       cd /usr/bin && ln -s apt-cyg apt-get && apt-get update
Related