What to copy when moving cygwin from one machine to the other? - windows

I'm reinstalling everything on my machine, and amongst those is Cygwin. I'm trying to avoid reinstallation, partly because I don't even know what it is that I've installed. Can I just move the Cygwin directory from one machine to another and expect everything to work, or are there some other important settings that I need to move as well?
As far as I saw, it's pretty self-contained, but one never knows.

Yep! Go for it. You won't encounter any problems.
You can just copy the entire cygwin directory to your new machine, open up the cygwin shell and everything (as long as you are only calling cygwin-internal programs and stuff that's within the path) will just work as if you you are working on your old machine.
The only thing you'll loose is the directory where the "already downloaded and compressed" packages for a possible re-installation are stored. Fortunately this directory is optional, so no problem for migration to another platform. You could copy that directory as well, but most likely all the packages that you have are outdated anyways and a run of setup.exe would fetch the new versions anyway...
Btw - since someone said exactly the opposite some real-life experience: I use this feature quite often with success. I've copied my cygwin dir to USB-sticks and used it on friends computers. I also copied it to the laptop of my fiance when we go to holidays and take a laptop with us.
It always worked without any problems....

The short answer is: No, you can't copy the whole Cygwin folder. You just copy the configuration files(bash files, vim file, etc.) you need.
The long answer is: If you copy the whole Cygwin folder, it may work in some case, and may not in some other case.
The reason is: you will lose linux file mode when copying files on Windows. And that will cause a lot of troubles. However, you may not have the troubles when you use Cygwin just like a common Windows Program(which means you don't care file mode and anything related), and run it as Windows Administrator(which is not required when Cygwin is installed as usual).
BTW: you can export the packages you installed by cygcheck.exe -c and install them on the new Cygwin. You can also install/update Cygwin packages by Cygwin's setup-x86_64.exe in command line like:
setup-x86_64.exe -q -P package1,package2,package3

No, you have to reinstall it from the cygwin installer, sorry!
Most importantly you'll want to copy everything from your home directory (default is c:/cygwin/home/) especially anything w/ a "." in front of the filename.
As for individual application preferences, etc., you may lose those -- but if you do the reinstall while you still have access to your old machine -- you can probably get to 90% of your previous install without too much trouble.

My experience with copying from one cygwin64 (I don't think there is a difference) to another machine is that all of the symbolic links got crushed:
As an example:
What used to be /usr/bin/cc -> /usr/bin/gcc.exe (or something like that)
After the copy /usr/bin/cc became a text file containing the string:
!<symlink>/usr/bin/gcc.exe
My method of copy was merely cp -r /cygwin/c/cygwin64 <dest>
My dest was a FAT32 FS, but I don't think that had anything to do with it.
There were also characters 0x00 and 0xFF sprinkled among many of these 'text' files so that they appeared to be binary.

Related

bash: find directory of program after following symlinks

This question is somewhat trickier than it sounds. I have installed the ardinuo IDE under /usr/local (not really the "normal" place -- most people would install it under $HOME). I then created symlinks to the two executables, ardinuo and (important to my case at hand) ardinuo-builder in /usr/local/bin. I made these relative links (../ardinuo-x.y.z/). I happen to have slightly different versions of the ardinuo IDE on different machines on my LAN, but I want to have a single build script (build.sh) that will run anywhere (and since I have the project up as a public project on GitHub, possibly on other people's machines). The ardinuo-builder needs to be passed the exact install directory of the ardinuo IDE, in order for it to find stuff it needs. I know how to deal with this with Tcl, but although I do have Tcl install on all of my machines, I would not expect that to be true of other people. I would like to get this done in bash, but I am not finding an obvious standard tool in /bin or /usr/bin that will do what I want. Any suggestions?

Copy python modules from one system to another

Is it possibe to copy all of the python modules from one Windows computer to another computer? They are both running the same version of Python 2.7.12.
The reason for doing so is that I have internet access on one of them, and manual installing modules on the other requires to much time because of dependencies.
I suppose you mean "copy the python installation from one system to another" (else the answer is: put your modules on a USB key and copy them to the other system).
the best way
The best way of course would be to install Python properly on the other system using setup. But as you said, all dependencies/external libraries that you could easily get using pip for instance would have to be re-done. Nothing impossible with a small batch script, even if you don't have internet, but you would have to get hold of all the .whl files.
the full treatment, portable-style
But if you cannot you can create a "portable" version of python like this:
zip the contents of C:\python27 to an USB key
copy all python DLLS: copy C:\windows\system32\py*DLL K: (if K is your usb drive)
unzip the contents of the archive somewhere on the second machine
add the DLLs directly in the python27 directory.
(those DLLs were installed in the windows system in previous Python versions, now it's even simpler since they are natively installed in the python directory)
The advantage of this method is that it can be automated to be performed on several machines.
There are some disadvantages too:
python is not seen as "installed" in the registry, so no "uninstall" is proposed. It's a portable install
associations with .py and .pyw are not done. But you can do it manually by altering some registry keys.
another method, better
You can have best of both worlds like this:
perform a basic install of python on the second machine
overwrite the install with the zip file
=> you get the registered install + the associations + the PATH... I would recommend that last method.
Last partial method, maybe best matching your question
Try copying the Lib directory only. It's where the libraries are installed. I'm not 100% sure but it worked for me when I wanted to put wx on a python install lacking wx.
Of course you will copy over already existing files, but they are the same so no problem. I let other people comment if this is acceptable or not. I'm not sure of all the installation mechanism, maybe that will fail in some particular case.
In my case, copy-pasting python installation didn't do the job.
You need to check the "C:\Users\\AppData\Roaming\Python*" folder. You may find installed python modules there. Copy and paste these into your source folder will add these modules to your python.

vim could load not tcl86.dll

Yesterday I built gvim (7.4.552, 32-bit) on Windows XP with +tcl +lua +python, MinGW make gave a few error messages about tcl lib (I'm using ActiveTcl8.6.3), but still gvim.exe was created.
I tried lua and tcl and everything worked as expected. But today gvim said it could not load library tcl86.dll. I had not changed anything to the system, and tcl86.dll is on search path. This is so confusing I don't even know where to look at.
This is my build command:
mingw32-make.exe -f Make_ming.mak LUA="d:/Lua/5.1" LUA_VER=52 TCL="D:/Tcl" TCL_VER=86 PYTHON="D:/Python27" PYTHON_VER=27 DYNAMIC_PYTHON=yes PYTHON3="D:/Python33" PYTHON3_VER=33 DYNAMIC_PYTHON3=yes FEATURES=HUGE GUI=yes gvim.exe
From os_win32.c, I built a tiny exe to load tcl86.dll, the error message pointed to zlib1.dll. A search showed there was a copy in c:\windows\system32, it was of lower version and smaller size than the one in tcl/bin.
Copying tcl/bin/zlib1.dll to $VIMRUNTIME solved the problem. Or, even better I thought, just delete the one in windows/system32.

Are there any portable versions of Git for Mac OSX?

I'd like to be able to do some development work on public/borrowed computers (where I have no root privileges) and I've managed to get most of my tools working off of a USB stick but I still haven't found a Git solution.
The portable versions of Git that I have found are Windows-only. Do you know of any Mac alternatives?
EDIT: I've gotten a few suggestions to just copy my current installation of git from /usr/bin and put that on a USB drive. That's a great idea but I don't have a current installation of git to copy from. I won't have my own computer back for a couple of weeks.
Would you happen to know where I could grab a pre-compiled version of git for OSX? I don't have access to homebrew or... anything really. Ideally I could just grab a zip file from somewhere and dump it on my USB stick.
I've managed to put together a solution based on ideas from several different people (thanks to all of you):
Download the Git binary for Mac OSX from git-scm.com. The downloaded DMG contains a PKG file.
Unpack the PKG file with unpkg or something similar. (This step is necessary because normally PKG files can only be installed with root privileges.)
Drop the etc and git folders that were just unpacked onto your USB stick.
Now, whenever you plug in your USB stick, just make sure to put the location of the git directory on your PATH (like this: export PATH=$PATH:/path/to/git/on/usb/stick) and you'll be good to go!
NOTE: I've tested many of the git commands using this method and most seem to work without any issues. However, git init will complain like this: warning: templates not found /usr/local/git/share/git-core/templates. Not surprising since the templates are actually on your USB stick and not /usr/local. Despite this warning my repos seem to be working just fine.
Add a environmental variable GIT_TEMPLATE_DIR
to quote the documentation
The template directory contains files and directories that will be
copied to the $GIT_DIR after it is created.
The template directory will be one of the following (in order):
the argument given with the --template option;
the contents of the $GIT_TEMPLATE_DIR environment variable;
the init.templatedir configuration variable; or
the default template directory: /usr/share/git-core/templates.
I've uploaded my /usr/bin/git and /usr/bin/git-shell to
http://www.club.cc.cmu.edu/~ajo/disseminate/git
http://www.club.cc.cmu.edu/~ajo/disseminate/git-shell
You can try those, but I have no idea if this approach is likely to work. (There are no interesting shared-library dependencies reported by otool -L, but I don't know what else might theoretically go wrong with the idea.)
FWIW, I use Mac OS X 10.8.2 and git version 1.7.10.2 (Apple Git-33).
Not sure if this is appropriate as an "answer", since I don't plan to leave those links working indefinitely. Maybe I (or someone) can delete this answer in a month or two.
Apple's command line tools for developers include git, I believe. You can find them on http://developer.apple.com/; you might need a free developer account. They package will want to install to /usr/bin etc., but you should be able to use pax to extract the contents wherever you want.

Emacs in Windows

How do you run Emacs in Windows?
What is the best flavor of Emacs to use in Windows, and where can I download it? And where is the .emacs file located?
I use EmacsW32, it works great. EDIT: I now use regular GNU Emacs 24, see below.
See its EmacsWiki page for details.
To me, the biggest advantage is that:
it has a version of emacsclient that starts the Emacs server if no server is running (open all your files in the same Emacs window)
it includes several useful packages such as Nxml
it has a Windows installer or you can build it from sources
And concerning XEmacs, according to this post by Steve Yegge:
To summarize, I've argued that XEmacs has a much lower market share, poorer performance, more bugs, much lower stability, and at this point probably fewer features than GNU Emacs. When you add it all up, it's the weaker candidate by a large margin.
EDIT: I now use regular GNU Emacs 24. It also contains Nxml, can be installed or built from sources, and with this wrapper, the Emacs server starts if no server is running. Cheers!
Note that GNU Emacs for Windows comes with two executables to start Emacs: "emacs.exe" and "runemacs.exe". The former keeps a DOS-Prompt window in the background, while the latter does not, so when if you choose that distribution and want to create a shortcut, be sure to launch "runemacs.exe".
Carl
Easiest way to find where the user init file is:
C-h v user-init-file
Easiest way to open it is (in the scratch buffer):
(find-file user-init-file)
and hit C-j to eval
Well, I personally really like what I have been using since I started with Emacs, which is GNU Emacs. It looks like it is built for windows too. That link also answers your .emacs file question. Here is a place you can download it. You should probably get version 22.2 (the latest).
If this is your first time, I hope you enjoy it! I know I absolutely love emacs!
I run it under cygwin. That also gives me a Unix-ish environment for shelling out commands with meta-!
I use a vanilla version of emacs. In my experience, this is very stable, simple, does everything I need, and doesn't add a bunch of bloat that I don't need. The .emacs file can be placed in C:\Users\YourName if the HOME environment variable is set. This is a great way to handle it because it works on a user basis and mimics emacs behavior on Linux. You can download the zip from any gnu software repository mirror in the emacs/windows folder. You want the file that is named emacs-xx.x-bin-i686-pc-mingw32.zip.
There are some great instructions for configuring emacs for windows here. Basically, "installation" boils down to:
Download emacs from a gnu mirror at emacs/windows/emacs-version-bin-i686-pc-mingw32.zip, and extract the zip to an appropriate folder. Preferably C:\emacs to avoid spaces in the filename.
Set the HOME environment variable to C:\Users\username (or whatever you want). Make it a user-only variable (if it is username-specific). This is where your .emacs file goes.
If you want a start menu or desktop shortcut, create a shortcut to bin/runemacs.exe.
Add c:\emacs\emacs-xx.x\bin\ to your path (user or system), so that you can run it from the command line.
Also, you can consider emacs-w64 for 64bit windows systems:
emacs-w64: http://sourceforge.net/projects/emacsbinw64/
See http://www.gnu.org/software/emacs/windows/ntemacs.html. Section 2.1 describes where to get it, and section 3.5 describes where the .emacs file goes (by default, in your home directory, as specified by the HOME environment variable).
I've run both GNU emacs and Xemacs on windows. I used to use it as my primary editor, email client etc, but not it's "just" an editor.
When I recently reinstalled to Vista I installed the latest GNU version. It works fine. So does Xemacs, but it does look like GNU have got their sh*t together so Xemacs isn't as compelling anymore.
I suggest you to use development version of GNU Emacs 23, which is pretty stable and to be released relatively soon. You can get weekly binary builds from the link below.
Latest GNU Emacs as a zip archive
I have a portable version with .emacs configure ready, which setup org mode, I-do, etc. It also included org sample file. I think that is a better start point for new comers.
Basically run with runemacs.bat and everything is ready.
http://nd.edu/~gsong/portable_emacs.html
I've encountered this problem, and discovered the fault (at least in my case) to be the existence of c:\site-lisp\site-start.el, a file that was created when EmacsW32 was installed, and which was not removed when I uninstalled it. (Vanilla GNU Emacs for Windows has c:\site-lisp in its load-path, and will try to load this file, which somehow winds up triggering that error.)
Solution: removing that whole directory (c:\site-lisp) worked for me, but you should just be able to remove the site-start.el file.
The best place to start, to get an MS Windows binary for GNU Emacs is ... GNU Emacs:
http://www.gnu.org/software/emacs/
(Oh, and how did I find that URL? From the Emacs manual, node Distribution. If you have access to Emacs anywhere, that's the place to go for such information.)
On that page you will see everything you need to know about obtaining Emacs. In particular, you will find a section called Obtaining/Downloading GNU Emacs, which links to a nearby GNU mirror. Clicking that link takes you to a page of links that download all Emacs releases since release 21.
More imporantly here, on that page of links you will also see a directory link named windows. Click that to get a page of links to Emacs binaries (executables) for MS Windows. That is the page you want.
Knowing the above information can help when you need to find the page again, if you haven't bookmarked it. But here is the final URL, directly: http://mirror.anl.gov/pub/gnu/emacs/windows/
When forced to use Windows, I ...
Download "Emacs for windows", and save it in some directory (henceforth referred to as EMACS_SOMEWHERE)
Drop a .cmd file in "Startup" to map, "My Documents" to H: drive with subst, or if "My Documents" resides on a remote server, I use the "Map Network Drive" thing in Explorer to have "My Documents" named H:. Then I create an environment variable named HOME in Windows and give it the name of "H:\". Now I can drop my .emacs file in "My Documents" and it will be read by emacs when it launches.
Then I create the H:\bin directory. Then I add "H:\bin" to my Windows "Path" environment variable.
Then I create a H:\bin\emacs.cmd file. It contains one line:
#call drive:\EMACS_SOMEWHERE\emacs-23.2\bin\emacsclientw.exe --alternate-editor=c:\programs\emacs-23.2\bin\runemacs.exe -n -c %*
This is a fair bit of work, but it will enable me to run the one and same emacs from either a windows command prompt or from a cygwin command prompt, provided that /cygdrive/h/bin is added to my cygwin PATH variable. Haven't used this setup for a while but as I recall, when I call the emacs.cmd with a new file over and over, they all end up being buffers in the one and same emacs session.
There was https://bitbucket.org/Haroogan/emacs-for-windows with the latest Emacs 25, but the whole page has been removed.
The benefit of this build and the emacs-w64 above is that they come with jpg, png, tiff DLLs as well as lxml DLL, which is needed for the new eww web browser.
I prefer to run Windows 10 + VcXsrv + Emacs 25 client in WSL. Emacs is my shell.
To access the .emacs file for your profile the easiest way is to open up emacs. Then do C-x C-, type in ~USERNAME/.emacs (or you can use init.el or one of the other flavours). Type your stuff into the file and C-x C-s (I think) to save it.
The actual file is located (in Windows XP) in c:\Documents and Settings\USERNAME.emacs.d(whatever you named the file), or the equivalent spelling/location on your system.
You can download GNU Emacs NT from here direct. It works fine in windows, make sure you create a shortcut to the runemacs.exe file rather than the emacs.exe file so it doesn't show a command prompt before opening!
XEmacs is less stable than GNU Emacs, and a lot of extensions are specifically written for GNU. I would recommend GNU > X.
You can place the .emacs file in the root of the drive it's installed on. Not sure whether you can add it elsewhere too...
Im using emacs32, I only have one problem with it really:
https://stackoverflow.com/questions/3625738/comint-previous-matching-input-in-emacsw32-is-not-interactive
If You Mean Emacs as Latex Editor for Windows 7.
Emacs4LS (Emacs 4 Latex Support under Windows 7) for newcomer for Emacs.
http://chunqishi.github.io/emacs4ls/
Easy Steps to Install.
Plugins Built-In.

Resources