Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Macaulay2 on Windows 10 with X server and Emacs GUI

Macaulay2 for 'Linux subsystem for Windows', with GUI

Macaulay 2, M2 for short, currently is mainly developed for Linux distros. For most Windows distro-s, use Cygwin to get Linux bash and through that, M2 command to start Macaulay2. However, Windows 10 for developers and insider builds come with a new feature, "Linux subsystem for Windows".

See the following sections for the steps for installation of, firstly, the Linux subsystem then M2, followed by installing and setting up an X server with emacs coupled with M2.

Get 'bash' for Windows and M2:

1.) Get Ubuntu "bash" in cmd Install "Linux subsystem for Windows" with ubuntu.

Follow instructions:

2.) Open Ubuntu bash.

Hit Start then type "bash", or open command prompt and type "bash".

3.) Install Macaulay 2 through bash.

Follow instructions: Tip: use the command in bash "lsb_release -a" to retrieve your Ubuntu's version.

Run emacs GUI, coupled with M2:

Secondly, get X server running with emacs GUI

1.) install an X server

2.) Set display to X server:


export DISPLAY=:0

3.) Install Emacs with X support


sudo apt-get install emacs
emacs # to see if it brings up GUI

4.) set up M2 environment for emacs:

  • Run Macaulay2: bash> M2
  • Run the following in M2: setupEmacs()
  • exit() M2
  • bash> emacs
  • to run M2 in emacs, hit F12
  • create new file, type
R = QQ[x,y]
f = symmetricPower(2,vars R)
  • select line 1 or line 2, hit F11 and see what the M2 buffer does inside emacs!

TeXmacs with M2

To install TeXmacs, run the following commands in bash:

#sudo dpkg -i texmacs*.deb
#sudo apt-get install -f

!!! Follow instructions here in stead:

Tips and tricks

  • To run M2 directly from windows cmd, passing all commandline arguments, create a file 'M2.bat' with the following content:
@echo off
bash -l -c "M2 -q %*"

(Make sure it's accessible in windows PATH.)

  • To run TeXmacs directly from windows cmd, as previously create a file 'texmacs.bat', with the following content:
@echo off
bash -l -c "export DISPLAY=:0 && texmacs %*"

(Make sure Xming is up and running!)


Copy link

Adding firefox is nice, since then it lets you
in Macaulay2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment