Cygwin
Cygwin is a fully separate (and native) unix system that can run within windows. Cygwin emulates tools that are exclusive to linux (fork, mmap, ioctl, ...) by passing those calls to the cygwin.dll library.
It's beautiful, you can even run an Xserver and have it integrate with your windows' windows. You can also run a full linux desktop within your Xwindow (although it is much faster to just use a terminal).
Cygwin comes without a CLI package manager, but packages can still be installed automatically using the cygwin installer's commandline arguments.
Install
chocolatey installs cygwin to C:\programdata\chocolatey\cygwin\tools\cygwin
Cygwin is built to be able to be run in a portable way. You install, update, and get new packages by re-running the cygwin installer.
Always install the 32 bit version of cygwin, unless you absolutely need it to be 64bit. It is much more supported. Cygwin doesn't seem to require any registry keys to be set, the only things that affect it's portability are some environment variables.
NOTE If you are using my package-setup script, always run it with a normal cygwin http-repo as a source, reboot, then run with the private key for a cygports repo. If you fail to do this, and run the cygports repo first, you may end up with corrupted packages.
Package Management
Best Sources http://lug.mtu.edu standard cygwin packages http://mirrors.kernel.org/sources.redhat.com/cygwinports/ precompiled cygports (https://sourceware.org/cygwinports/) ## Start Cygwin with GPG key for cygports /path/to/setup-x86.exe -K http://cygwinports.org/ports.gpg
CYGPORTS CONTAINS DWM, MPD, NCMPC, PYSIDE
Cygwin doesn't have a traditional package manager. There are a few terminal programs you can use to emulate apt-get, but since on Windows files cannot be deleted or overwritten while they are running it is best to quit cygwin, and install programs using the installer.Because of cygwin's limited options in the default repo, I find myself compiling packages myself quite a lot. I created a git repo for compiled (and attempts at compiling) programs for quick (manual) installations on new machines.
There is also a system loosely based on Gentoo's portage to assist in compilation. It is called cygports, and can be installed from the main package manager.
Common Problems
rebase
Almost all issues related to cygwin can be resolved by rebasing. You can do it the quick/dirty way:
C:/cygwin/bin/dash.exe /bin/rebaseallOr the full proper way:
- Open Task Manager and close any processes that look to be Cygwin related. - Open C:\Cygwin\bin in Windows Explorer - Verify that dash.exe, ash.exe, rebase.exe, and rebaseall exist in this folder - If any of them are missing, re-run Cygwin setup and select the dash, ash, and rebase packages - right-click your C:\Cygwin folder, uncheck Read-only (if its checked), and press OK. - When an error about not being able to switch some files comes up, select "Ignore All". Wait for this process to complete. - Browse to C:\Cygwin\bin in Windows Explorer - Right click dash.exe and click "Run as Administrator". A command Prompt should appear with nothing but a $ - Type /usr/bin/rebaseall -v, hit enter, and wait for the process to complete. - If you get errors about Cygwin processes running, try Step 1 again. If that still doesn't work, Restart your computer into safe mode and try these steps again. - A commenter noted that, depending on your settings, you may have to type cd /usr/bin && ./rebaseall -v instead. - Try opening Cygwin again.
http://stackoverflow.com/questions/9300722/cygwin-error-bash-fork-retry-resource-temporarily-unavailable http://cygwin.wikia.com/wiki/Rebaseall
Programs
Cygwin does not by default include a CLI package manager. Instead, you run cygwin.exe with the flag 'config', which updates your existing cygwin (labeled as installation, but only checks for missing/out of date files). I have included the option of running 'CygwinPers.bat --config'. There are package managers available for cygwin, such as apt-cyg, but they're pretty awful. It is much better to just use the default installer.
Base Packages:
## Cygwin Packages bc offlineimap msmtp mutt w3m ncurses abook xclip git, git-completion, gitk, tig openssh gcc automake python2 python3 xorg rxvt-unicode nc nc6 tmux zsh irssi rsync ## External Packages: urlview (win32) -- http://www.oocities.org/win32mutt/win32.html mutt with sidebar -- http://www.alexbr.com/wblog/?p=183Terminal Programs
mintty openssh mutt mpd
X Programs
Xserver
CygwinX
%terminal%/cygwin/app/cygwin/cygwinXpers.batcygwinXpers.bat personal launcher script ~/.xstartwinrc.startxwinrc customize startup of xwin IMPORTANT NOTE IF YOU ARE RUNNING WINDOWS AS A DIFFERENT USER THAN 'will' (ex: willp). My workaround for both
.xinitrc
, and.config/openbox
. was to use symbolic links to their locations in will.ln -s /home/will /home/willp
# xorg-xerver # win-xorg-clipboard # There are options to customize startx and startxwin, # I prefer to leave startxwin blank because when left alone, # it can run ANY program as an argument, and it will create a # windows' window for it. #### ~/.startxwin ## Any instructions to be run every time startxwin is run #### ~/.xinitrc ## Any instructions to be run every time startx is run #### man xwin ## commandline flags for startxwin/startx startx (programs to run) -- (xwin flags) -rootless (no window decorations on xserver) -keyhook (cygwin sees keypresses before windows) (allows windows key to be used) ex: startx /usr/bin/openbox -- -rootless -keyhoook ## start openbox in same windowspace as windows
WINAPI
I'm not entirely sure what this is, or how it works but this is how DWM is able to run natively in windows, and manage win32 windows ( but not cygwin windows unless launched with startxwin /usr/bin/<progrm> )
Fonts
/usr/share/fonts/font.ttffont dir fc-listlist all fonts There is not a lot of options for fonts in the cygwin package repo, Here are the fonts that I use most frequently:
## Droid-Sans-Mono (preference) http://www.fontsquirrel.com/fonts/droid-sans-mono ## DejaVu http://sourceforge.net/projects/dejavu/ ## copy fonts to /usr/share/fonts/ fc-list ##List all currently available fonts Urxvt.font: xft:Droid Sans Mono-10 ##Setting font for urxvt in ~/.Xdefaultsfeh
feh is an awesome image viewer. requires imlib2
## CYGWIN DEPENDENCIES: # imlib2, libcurl, libcurl-devel, libpng, libX11, libXinerama, libXt-devel # make sure to install all imlib, imlib2, libiml, and devel packages from setup.exe # # note that when hunting down a package because of a compile error, you can use # cygcheck for more info ex: cygcheck -p x11/Intrinsic.h curl -#O http://feh.finalrewind.org/feh-2.12.tar.bz2 make make install cp feh.exe /usr/bin/