Skip to content

Instantly share code, notes, and snippets.

Embed
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: https://msdn.microsoft.com/en-us/commandline/wsl/install_guide

2.) Open Ubuntu bash.

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

3.) Install Macaulay 2 through bash.

Follow instructions: http://www.math.uiuc.edu/Macaulay2/Downloads/GNU-Linux/Ubuntu/index.html 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:

bash:

export DISPLAY=:0

3.) Install Emacs with X support

bash:

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:

#cd
#wget http://mirrors.kernel.org/ubuntu/pool/universe/t/texmacs-extra-fonts/texmacs-extra-fonts_0.2_all.deb
#wget http://mirrors.kernel.org/ubuntu/pool/universe/t/texmacs/texmacs-common_1.0.7.18-1_all.deb
#wget http://mirrors.kernel.org/ubuntu/pool/universe/t/texmacs/texmacs_1.0.7.18-1_amd64.deb
#sudo dpkg -i texmacs*.deb
#sudo apt-get install -f

!!! Follow instructions here in stead: https://software.opensuse.org/download.html?project=home:slowphil:texmacs-devel&package=texmacs

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!)

Sources:

@kschwede

This comment has been minimized.

Copy link

@kschwede kschwede commented May 11, 2020

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

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