Cannot launch command-line session in macOS on M1: libncurses issue

695 views
Skip to first unread message

Murray Eisenberg

unread,
Aug 29, 2022, 1:45:26 PM8/29/22
to sage-devel
With SageMath 9-6-1.4.2 (arm64 architecture) under macOS 12.5.1 on an M1 Mac, I cannot start the sage on a command line, neither directly in Terminal using command sage nor from the SageMath app with choice of Command line interface. In each case, I get error message about the wrong architecture libncurses.


I installed SageMath, including Recommended_9_6.pkg, using SageMath-9.6-1.4.2_arm64.dmg from https://github.com/3-manifolds/Sage_m....

Note that I can successfully launch the jupyter notebook interface from SageMath-9-6.app and run Sage commands there.

How to fix this?

G. M.-S.

unread,
Aug 29, 2022, 2:08:46 PM8/29/22
to sage-...@googlegroups.com

I have just installed this version of SageMath under exactly the same conditions and I have no problem at all.

Perhaps you have a wrong version of libncurses installed, because mine is version 5 (more precisely 5.4) and not 6.

Guillermo

Murray Eisenberg

unread,
Aug 29, 2022, 3:08:03 PM8/29/22
to sage-devel
How did you install libncurses? I have:

/Library/Frameworks/Python.framework/Versions/3.6/lib/libncursesw.5.dylib
/Library/Frameworks/Python.framework/Versions/3.5/lib/libncursesw.5.dylib
/opt/local/lib/libncurses.dylib      [installed from MacPorts]

So probably the issue is my PATH. In /etc/paths, I have:

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/opt/local/bin
/Applications/Macaulay2-1.20/bin

My default shell (and, I presume, login shell) under macOS Monterey is zsh. My .zprofile source's .profile, And in .profile, I do _not_ have any entry for /opt/local/lib. So I don't understand why SageMath is picking that up. Not there, and not in .profile 

Murray Eisenberg

unread,
Aug 29, 2022, 3:59:25 PM8/29/22
to sage-...@googlegroups.com, list...@gmail.com
I see at https://invisible-island.net/ncurses/announce.html that the current stable version of ncurses is, in fact, 6.3.

-- 
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/tOA6n3wjc7w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CANnG189KoifPLzBFbdqHYxVfnpTyxPBr%2BTSzenfNCQYcq9dYDA%40mail.gmail.com.

---
Murray Eisenberg murraye...@gmail.com
Mobile (413)-427-5334
503 King Farm Blvd #101
Rockville, MD 20850-6667



Dima Pasechnik

unread,
Aug 29, 2022, 4:12:52 PM8/29/22
to sage-devel
What's the value of PATH in your terminal session? I.e. what's the output of

echo $PATH

(I'm not sure what /etc/paths have to do with this - this is something static)
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/2AA61DCE-1456-4497-A8E6-9561212461B7%40gmail.com.

Murray Eisenberg

unread,
Aug 29, 2022, 7:32:21 PM8/29/22
to sage-...@googlegroups.com
echo $PATH

/opt/anaconda3/condabin:/opt/local/lib/mysql8/bin:/Library/TeX/texbin:/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/Applications/Macaulay2-1.20/bin:/Library/TeX/texbin:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/theuser/.cargo/bin:/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/local/sbin:/Users/theuser/bin:/Users/theuser/bin/shell:/Users/theuser/bin/python:/Users/theuser/.local/bin:/Users/theuser/.cargo/bin:/opt/local/share/matlab2tikz/src:/Applications/Singular/Contents/bin:/Applications/Singular/Contents/bin/lib:/Users/theuser/.elan/bin:/opt/local/libexec/git-core:/Applications:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/theuser/Library/Application Support/GoodSync
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CAAWYfq2jx0BniOxtZo6ha_%2BZaxY7Z%3DHVGRMFqxn_pzQQrGzUKQ%40mail.gmail.com.

Dima Pasechnik

unread,
Aug 29, 2022, 7:57:05 PM8/29/22
to sage-devel
No, PATH has nothing to do with libraries loading. Most probably it's due to libraries  in /opt/local/lib/ which
conflict, and are looked at by linker or loader...

Can you temporarity move  /opt/local/lib/ to /opt/local/lib.bak/
and try again?
 

Murray Eisenberg

unread,
Aug 29, 2022, 8:54:04 PM8/29/22
to sage-...@googlegroups.com, dim...@gmail.com
OK, moved /opt/local/lib/ to /opt/local/lib.bak/. Now in Terminal:

[~] % sage
dyld[55752]: Library not loaded: '/opt/local/lib/libncurses.6.dylib'
  Referenced from: '/usr/local/bin/bash'
  Reason: tried: '/opt/local/lib/libncurses.6.dylib' (no such file), '/usr/local/lib/libncurses.6.dylib' (no such file), '/usr/lib/libncurses.6.dylib' (no such file)
/usr/local/bin/sage: line 20: 55752 Abort trap: 6           /usr/bin/env - PATH="$PATH" $MIN_ENV "$SYMLINK"/venv/bin/sage "$@"

Matthias Koeppe

unread,
Aug 30, 2022, 2:12:24 PM8/30/22
to sage-devel
In a response on the ticket https://trac.sagemath.org/ticket/34459, I wrote:  
What is in /usr/local on this machine and where does it come from?

Murray Eisenberg

unread,
Aug 30, 2022, 3:39:12 PM8/30/22
to sage-...@googlegroups.com, matthia...@gmail.com
In response to your cited comment that ticket, I replied:

In /usr/local there is no libncurses.*

(In /usr/local/lib/fpc -- from Free Pascal Compiler -- there are a couple dozen ncurses modules, but no libncurses.*.)


Murray Eisenberg

unread,
Aug 31, 2022, 9:45:12 AM8/31/22
to sage-devel
A MacPorts user solved the libncures problem for me: I had to install the MacPorts port "ncurses + universal" instead of just "ncurses".
But now a new error when I run the sage command:

dyld[3024]: Library not loaded: '/opt/local/lib/libintl.8.dylib'
  Referenced from: '/usr/local/bin/bash'
  Reason: tried: '/opt/local/lib/libintl.8.dylib' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64))), '/usr/local/lib/libintl.8.dylib' (no such file), '/usr/lib/libintl.8.dylib' (no such file)
/usr/local/bin/sage: line 20:  3024 Abort trap: 6           /usr/bin/env - PATH="$PATH" $MIN_ENV "$SYMLINK"/venv/bin/sage "$@"

The file /opt/local/lib/libintl.8.dylib had to have come from some MacPorts port.

The question is ,which one!? MacPorts has no such port named "libintl" or "intl". But it does provide ports with names phpxx-intl, py-elib.intl, p5.30-libintl-perl. 

Murray Eisenberg

unread,
Aug 31, 2022, 9:53:07 AM8/31/22
to sage-...@googlegroups.com
Thanks to a MacPorts user, I was able to determine that the libintl file came from the port gettext-runtime.

The solution was to uninstall that port and in its place install its universal variant: port install gettext-runtime +universal.

Now the sage command runs. 

-- 
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/tOA6n3wjc7w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages