Download installed, run it and additionally select:
Add Cygwin's /bin to Windows' PATH so you could lauch mintty and clone apt-cyg and add it to PATH too:
cd ~/work/cygwin git clone https://github.com/kou1okada/apt-cyg cp apt-cyg/apt-cyg ~/.local/bin
Integrate bash-completion for apt-cyg:
apt-cyg install bash-completion apt-cyg completion-install
Important packages:
bash-completion - for human CLI.
emacs-w32 - Cygwin's Emacs with native Windows widgets!
vim - let's have "improved" VI.
aspell, aspell-en - for spell checking inside Emacs.
curl - for HTTP troubleshooting.
wget - for recursive downloading, also required by apt-cyg.
VCS packages:
mercurial git git-completion git-svn subversion fossil
make - my favorite automation tool.
the_silver_searcher - human grep.
Run setup.exe. Today you should prefer 64-bit flavor because it sould less BLODA. Add Cygwin /bin directory to your PATH env var:
set PATH=c:\opt\cygwin\bin;%PATH%
Cygwin behavior can be altered via CYGWIN env var:
set CYGWIN=noglob wincmdln
noglob disable reinterpreting positional arguments native Windows application as if they contain shell wildcards. With glob running ls * from cmd works as if it is run from Unix shell.
When I used native Emacs & Cygwin wrapper for hg default option glob broke Emacs VC mode because Emacs is using {rev} as one of the arguments and it was replaced by empty string when glob is active.
noglob enshures that there are no any magical replacement.
wincmdln helps during process invocation troubleshooting. Cygwin maintains own structures for program positional arguments so argument list is invisible to Windows programs like Process Monitor. The option wincmdln tells Cygwin program to copy internal structure for arguments to Windows managed structure making arguments visible.
The easiest way to install env var CYGWIN is via .reg file:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment] "CYGWIN"="noglob wincmdln"
Set TMP and TEMP env vars without dangerous symbols in path (without spaces, etc):
set TMP=c:\tmp set TEMP=c:\tmp
Also you need to edit /etc/passwd to point to correct home path.
For Cygwin 1.7 /etc/nsswitch.conf settings is used to define user home. By default it is /home/%U so it is better to create symlink:
$ ln -s /cygdrive/d/home /home/user
Alternatively with native Windows symlink (from build-in cmd command):
cmd# mklink /D c:\opt\cygwin\home\user c:\home
List of installed packages (-c - check, -d - dump only):
$ cygcheck -c -d
Alternatively look to file content:
/etc/setup/installed.db
In a past I work with particular code point:
set LANG=ru_RU.cp1251
Altering LANG for anything other then C cause only problems, when you get help and error messages in non-English. It is mostlry impossible to search for keywords, when text are translated.
In Cygwin the 3rd parameter (FS type) has special meaning:
/etc/fstab:
none /cygdrive none binary,posix=0,user,noacl 0 0 c:/opt/ /opt none binary,noacl,user,posix=0 0 0 d:/backup /backup none binary,noacl,user,posix=0 0 0 /var /usr/var none bind
Recent version of Win 10 exposes WSL distros via P9 network protocol. As Cygwin supports UNC paths it is possible to add mount points (don't forget to create directory /wsl before mounting!):
//wsl$/debian /wsl/debian ntfs binary,noacl,posix=0 0 0 //wsl$/ubuntu /wsl/ubuntu ntfs binary,noacl,posix=0 0 0 //wsl$/alpine /wsl/alpine ntfs binary,noacl,posix=0 0 0
Cygwin allow complex mapping Windows accounts to POSIX:
Modern Cygwin (v3.x) relies on /etc/nsswitch.conf for user settings. That means there are no /etc/passwd & /etc/group and user home directory and login shell are defined according to nsswitch.conf:
db_home: /home/%U db_shell: /bin/bash
Earlier Cygwin used /etc/passwd & /etc/group and sometimes you were required to regenerate them:
$ mkpasswd -d | grep $yourlogin > /etc/passwd $ mkpasswd -l > /etc/passwd $ mkgroup -l > /etc/group
Cygwin C API man pages and user guide manuals available in cygwin-doc package.
Documentation is unpacked into /usr/share/doc/cygwin-... directories.
For system man pages install: man-pages-posix.
apt-cyg is based on bash, wget, tar, gawk and bzip2 packages and provide convenient commands for managing and queries packages:
$ apt-cyg update $ apt-cyg install emacs-w32 $ apt-cyg remove emacs-w32
Information about package and dependencies:
$ apt-cyg show emacs-w32 $ apt-cyg depends wget $ apt-cyg rdepends emacs
List installed packages:
$ apt-cyg list
Search for package with file across installed packages:
$ apt-cyg search stdio.h
List package files for installed packages:
$ apt-cyg listfiles util-linux
Search for package with file through cygwin.com:
$ apt-cyg searchall stdio.h
List all packages in setup.ini:
$ apt-cyg listall
Find package by regex:
$ apt-cyg listall ^emacs
To switch between mirrors:
$ apt-cyg mirror ftp://ftp.cygwinports.org/pub/cygwinports $ apt-cyg update $ apt-cyg install php $ apt-cyg mirror ftp://www.fruitbat.org/pub/cygwin/circa/2016/08/30/104223 $ apt-cyg mirror http://mirrors.kernel.org/sources.redhat.com/cygwin/
Just switching mirror does not update metadata.
To change a location of directory where packages and setup.ini downloaded:
$ apt-cyg cache C:\net $ apt-cyg cache ~/net Cache set to C:\home\net.
Cygwin bash has extra patch that adds completion_strip_exe option:
shopt -s completion_strip_exe
If you complete executable .exe suffix is stripped if any. That halps with bash-completion because usually comletion defined for base name without .exe suffix, like:
complete -F _figlet figlet
Get list of permissions:
$ getfacl .
rsync without problems:
$ rsync -ar —chmod=ugo=rwX $FROM/ $TO/
Cygwin from v2.5.5 and Setup version 2.874 (on 25 Aug 2016) is latest version with Windows XP support. Later versions build with dependencies on newer syscalls and failt to run in Windows XP.
Latest mirrors avaialble at fruitbat.org:
To run setup against this mirror:
cmd> setup.exe
setup.exe available at:
Run as (-X disable signature verification, -s <url> option select a particular mirror, -O option disallow any other mirrors):
cmd> setup-x86.exe -X -s ftp://www.fruitbat.org/pub/cygwin/circa/2016/08/30/104223 -O
This project provides Cygwin binary and source packages for a large variety of programs and libraries, including the GNOME and KDE desktop environments
$ uname -r 1.7.7(0.230/5/3) $ cygcheck -c cygwin Cygwin Package Information Package Version Status cygwin 1.7.7-1 OK
Today rebaseall script takes care of DLL acrees clashes. It is shell script that should be run from ash (a special Cygwin shell that compatible with rebase process in egg-chicken mean), like you close every Cygwin program (including Windows services) and run from cmd.exe or PowerShell:
sh -c rebaseall
With modern Emacs 28.1-2 introduced native compilation for every user using Emacs you need to add Emacs's dynamic modules to the update list under /var/lib/rebase/userpath.d (user below is a placeholder):
$ cat /var/lib/rebase/userpath.d/user /home/user/.emacs.d/eln-cache
In order to Cygwin to maintain fork() syscall it should preserve same logical base address for dll to be able to share library between child and parent process. It was done via special hints in dlls.
With new version of Cygwin software or external Windows libraries (AntiVirus may inject its their libraries into Cygwin process address space) it may happen that new library is overlapped with existing.
There is rebase utility that changes base address hints for dll.
You should finish all Cygwin processes in order to rebase to succeed.
You may trigger automatic rebase of all packages in next run of setup.exe with:
$ rebase-trigger full
Read more at:
$ XWin -multiwindow&
or:
$ XWin -clipboard -silent-dup-error -xkblayout "us,ru" -xkboptions "grp:caps_toggle"&
To start X application you must set 'DISPLAY':
$ DISPLAY=:0 xterm&
$ cygcheck -c -d
$ cygcheck -l pkg-name
$ cygcheck -f full-path-to-file
$ for f in /etc/setup/*.lst.gz; do gzip -c -d $f | grep $WORD 2>&1 >/dev/null && { echo $f; break; } || :; done
If you have file name or regex use (need internet connection):
$ cygcheck -p REGEX
cygcheck use such link:
http://cygwin.com/cgi-bin2/package-grep.cgi?grep=REGEX
$ uname -a $ cygcheck -s -r
$ ldd my.dll $ ldd my.exe $ cygcheck ./my.dll $ cygcheck ./my.exe