Note: The Microsoft Windows distribution of Macaulay2 version 1.7 has been delayed, due to a bug in "ld" under "Cygwin", see #155.
Macaulay2 for Microsoft Windows has been compiled under the 32 bit version of Cygwin, a system that provides Microsoft Windows with a high degree of compatibility with the GNU operating system (upon which GNU/Linux is based), which you will need in order to install and to run Macaulay2. Visit http://cygwin.com/ to download the program setup-x86.exe and to install Cygwin, if you haven't done so already. The initial minimal installation takes 77MB, excluding the temporary download files, which can be manually deleted later; the final installation, including Macaulay2, emacs, and X Windows, takes 572MB.
You may use setup-x86.exe to install Macaulay2 by telling it the location of our Cygwin repository. It will download the needed file(s) and install any prerequisite packages that haven't yet been installed. It is important to start setup-x86.exe with the full path to the public key file Macaulay2-key.data, which you should download and save, so it can use it to verify the signature attached to our setup.ini file. Suppose you have downloaded and saved setup-x86.exe in the directory F:\foo\bar, and you have downloaded and saved Macaulay2-key.data in J:\goo\car. Then the command would be:
F:\foo\bar\setup-x86 -K J:\goo\car\Macaulay2-key.data
Use the command above in a command prompt window, in a command prompt window running as an administrator, in the "Run" window, or in a shortcut that you create. (The setup command presumably changes directories before looking for the specified key file, which is why the full path to the key file must be specified. Inconvenient but true.)
Here is the way to tell Cygwin's setup-x86 program the location of the Macaulay2 repository. (You may tell it the first time you use it, or any subsequent time.) After it downloads the list of mirror sites from cygwin.com, it displays a dialogue box entitled Choose A Download Site. Add our site to the list of available sites by entering
in the box labelled User URL and pressing the Add button. Normally our site's domain name will then be highlighted, as will the domain name of the Cygwin mirror used for your initial installation of Cygwin. If you see that only one download site is highlighted, then highlight a Cygwin mirror site geographically near you by clicking on it (all of the other names on the list are names of Cygwin mirror sites), and then highlight our site by clicking on it with the left button while holding down the control key, so that now you have both sites highlighted. Warning: if you highlight just our site, then packages upon which Macaulay2 depends may not be installed for you by the Cygwin setup program, and our program will not run. The next time you run the Cygwin setup program, simply leave these two mirror sites highlighted, and all will be well.
Now press the Next button and examine the Select Packages dialogue box. Initially the "View" is set to to "Category", but pushing the button changes it to "Full". Enter the first four letters or so of "Macaulay2" into the "Search" box and the packages Macaulay2 and Macaulay2-icons will appear; the packages have independent version numbers. Installing the latter package is equivalent to installing the most recent version of the former, together with convenient shortcuts for starting up X Windows, emacs, and Macaulay2 with a single click. Press the spinning arrow symbol under "New" for the desired package to replace the desired action (initially set to "Skip") by the desired version number of Macaulay2. After you press the Next button, the package will be installed, along with the other 87 packages it needs, including emacs and X Windows.
Assuming you installed the package Macaulay2-icons in the previous step, you may now start up X Windows, emacs, and Macaulay2 by clicking on the shortcut on your desktop, or in the start menu folder called Macaulay2, whose name is XWin + emacs + M2. If X Windows is already running, then use the shortcut whose name is emacs + M2 on 0. An emacs window should eventually pop up with Macaulay2 running in a command interaction buffer.
Installing Macaulay2 as described above will set all paths appropriately and make the Macaulay2 emacs files visible to emacs, so users will not have to run the "setup()" function in Macaulay2. However, if you run the "setupEmacs()" function in Macaulay2, then code will be added to your emacs init file that arranges for the f12 function key to be bound to the emacs "M2" function, which starts Macaulay2 running in an interactive emacs buffer. One way to run the new code in your emacs init file is to restart emacs, after which the f12 key in emacs should work. If you don't run "setupEmacs()" in Macaulay2, you can always start Macaulay2 in emacs with the keystrokes M-x M2 in emacs.
Users new to emacs should spend some time becoming accustomed to it. A good place to start learning how to use emacs is with the Emacs Tutorial, which can be accessed after starting emacs.
Here are some solutions for some common problems that occur when running Cygwin.
- setup-x86.exe keeps offering to make cygwin shortcuts on my desktop, even though I don't want them. Solution: add -n to the command line.
- I typed the URL of the Macaulay2 cygwin repository incorrectly, but there seems to be no way to edit it or to remove it from the list of download sites known to setup-x86.exe. Solution: Unhighlight that download site in the list and exit the program. The next time, it won't be there.
- emacs can't interrupt Macaulay2 with C-c C-c: Cause: a bug in the way emacs sends interrupts to subjobs. Solution: send a C-c character to Macaulay2 with C-q C-c RETURN. A future version of emacs will address the problem, at least for interruption of loops, but perhaps not for interruption of printing.
- emacs can't start M2 for want of resources: Cause: unclear; solution: try this: shut down all Cygwin processes, start up a Windows shell, navigate to C:/cygwin/bin, run "ash.exe", and run "./rebaseall -v".
- M2 runs a program and gets this message: "linked dll data write copy failed": Cause: unclear; try this: shut down all Cygwin processes, start up a Windows shell, navigate to C:/cygwin/bin, run "ash.exe", and run "./rebaseall -v". Alternatively, refer to this list of programs that might interfere with cygwin, and try shutting down any of them that are running on your machine.
- It's hard to locate files from within Macaulay2 or emacs. Cause: Cygwin and Microsoft Windows have different roots for their file systems. Solution: within a Cygwin program, such as M2 or emacs, the root of drive C (for example) can be accessed as "/cygdrive/c". Within a Microsoft Windows program, such as the explorer or firefox, the root of Cygwin's file system is visible as "C:/cygwin", if Cygwin was installed in the usual location. The program cygpath can be used to translate paths in either direction.
- I ask setup-x86.exe to install something, and it doesn't install it. A good way to see what setup will install in the final step, before going there, is to press the "View" button in the upper right hand corner until the text to the right of it says "Pending". Then the list below will consist of those Cygwin packages it intends to install or upgrade.
Let us know if there are any (further) problems!