Install TeXmacs with Maxima on mac with M1

I went to the folder /usr/local/bin. which should be the folder that texmacs looks at to open the sessions, inside this folder there are many type files (Alias and Unix files) but there is only one folder file called maxima, it is strange as what?

It’s totally expected.

If you are not familiar with Linux semantics, read https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

What confuses me is that there seem to be files both under /opt/local/bin and under /usr/local/bin. Are there two installations of Maxima on the system?

The shell picks up the binary in /opt, while TeXmacs seems to detect /usr/local/bin/maxima, which turns out to be a directory.

I’ve just done a test and the url-resolve-in-path function returns directories in the path, if they have the right name. This is different from the behaviour of which.

Since Dodier was involved with that (https://lists.texmacs.org/wws/arc/texmacs-users/2021-10/msg00000.html), we might involve him again, if he is still available :wink:

But in my opinion it is easiest for @marcomolisano—since he has had contact with all of the people— to make sure that Maxima is installed in his system (which as far as I know no-one on this forum has, so we can’t do any tests) properly, and after that it is still easiest for him to get the info on how to fix PATH (same reason, unless there are some Mac users who did not show up so far!).

Once we are over the sticking points, then we can work again on getting the Maxima plugin to work.

@marcomolisano

I am using M1 mac, and it wasn’t showed up too. I am using the homebrew maxima which is installed /opt/homebrew/bin/maxima.

But i simply do the following from terminal,

$ cd /Applications/TeXmacs.app/Contents/MacOS/
$ ./TeXmacs

And it works:

There must be a bug, but i don’t know exact where.

2 Likes

Thanks, @slbtty. Could you do

(url-resolve-in-path "maxima")

in your single-path experiment?

Does url-resolve-in-path give you the same result if you start TeXmacs from the terminal?

I guess Maxima could rely on other programs being on the path, so that may be why it fails.
You could check by doing

(var-eval-system "maxima --list-avail")

@slbtty I don’t really know how to thank you !!! opening texmacs with the command from the terminal everything works !!
Thanks so much everyone for the support!!!

1 Like

In case anyone needs this, I have compiled successfully a native M1 version that just works with the Homebrew maxima. Please look Building Natively on M1 with macOS Monterey for instructions.

1 Like

It helps me to install julia plugin in M1

This is a bit off topic but this issue has not been fixed yet. Probably we should have a settings that one can prepend some more PATHs to the system-provided PATH when TeXmacs start. On macOS we should even add /opt/homebrew/bin to PATH by default.

@darcy

Not even TeXmacs, I think those apps started from spotlight search or clicking the icon are not aware of you “startup shell”.

I have the same issue after switching from manually downloading the latest stand-alone maxima version 5.43 to the actual latest maxima 5.46 MacPorts version.

Since switching to MacPorts, TeXmacs can not find maxima without opening from terminal. I guess that TeXmacs somehow does not execute the .zshrc file and therefore does not get the correct PATH environment variable.

My maxima installation is located at: /opt/local/bin/maxima.
TeXmacs: 2.1.1
MacOS: 10.13.6 (High Sierra)

PS. I have re-installed TeXmacs and rebooted to no avail.

There are several suggestions around on how to set PATH on a Mac. Has anyone tried them?

https://apple.stackexchange.com/questions/51677/how-to-set-path-for-finder-launched-applications

I tried launchctl setenv PATH $PATH from my .zshrc file. But I don’t see how that could work since I want my PATH to be updated when opening TeXmacs from the Dock/Applications. ~/.launchd.conf also didn’t work. Probably due to the same issue.

I tried to set Login Items to my .zshrc file but that didn’t work. I moved my wxMaxima app out of the MacPorts folder in /Applications to be in /Applications. TeXmacs didn’t find it, though it finds:

  • “/Applications/Octave-6.2.0.app/Contents/Resources/usr/Cellar/gnuplot-octave-app/5.4.0/bin”
  • “/Applications/Octave-6.2.0.app/Contents/Resources/usr/Cellar/octave-octave-app@6.2.0/6.2.0/bin”
  • “/Applications/Octave-6.2.0.app/Contents/Resources/usr/bin”.

Since I can not update the PATH for TeXmacs. I decided to put Maxima in the PATH for TeXmacs (/usr/local/bin).

sudo ln -s $(which maxima) /usr/local/bin/maxima

Now it works!:tm:

In the future it would be nice if TeXmacs added /opt/local/bin to the PATH since that is where MacPorts installs maxima.

I wanted to link to the MacPorts installation file to show where that is set but I can’t find which line. I’m new to MacPorts, so don’t know if installation folders are configurable.

PS. The oneliner terminal script above, creates a symbolic link in /usr/local/bin/maxima that points to your maxima installation. TeXmacs looks in /usr/local/bin, so it will find maxima when there is a link to maxima there.

It’s not exactly TeXmacs’ job to set up the environment. If it would do that, the next thing people will be complaining is it doesn’t respect their PATH variable.

The very reason for an environment variable is to pass information from the environment to a program. There’s no point in messing with it. Frankly, it’s surprising how messed up such a very important feature seems to be on Mac.

IMHO, a much better option would be to implement user overrides, along the lines of “if the user has defined a variable maxima-path and if that file exists, use it. Otherwise check the path”.

1 Like

Ever tried to modify /etc/launchd.conf as suggested here:
https://www.bounga.org/tips/2020/04/07/instructs-mac-os-gui-apps-about-path-environment-variable/
Apps launched in Finder will not spawn any shell so modify the shell configuration scripts will have no effect. An ugly fix is to launch apps from a shell with correct environment variables (the process will inherit the environment of the shell), but this is not a permanent fix.

Actually it seems this is not supported on earlier systems. The “new way” is described here; https://stackoverflow.com/questions/25385934/setting-environment-variables-via-launchd-conf-no-longer-works-in-os-x-yosemite and goes via the file ~/Library/LaunchAgents/environment.plist . Probably is better to check the manual pages of your version of MacOS. For example looking at launchctl man page there is the following command


     setenv key value
              Specify an environment variable to be set on all future processes launched by launchd in the caller's context.

which can be useful.

Another hint: Autodesk suggest the following method: https://help.autodesk.com/view/SGSUB/ENU/?guid=SG_RV_rv_knowledge_base_rv_setting_global_variables_osx_html which uses a service to run launchclt and set up the environment variables. Seems convoluted but makes sense and probably should also work.