Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot initialize Ncurses in macOS #455

Closed
ronisbr opened this issue Feb 1, 2020 · 5 comments
Closed

Cannot initialize Ncurses in macOS #455

ronisbr opened this issue Feb 1, 2020 · 5 comments

Comments

@ronisbr
Copy link

ronisbr commented Feb 1, 2020

Hi!

For some reason, I cannot initialize Ncurses using Ncurses_jll in macOS.

julia> using Ncurses_jll

julia> ccall( (:initscr, libncurses), Cvoid, ())
Error opening terminal: xterm-256color.

After that, julia crashes. Passing the env. option TERM=xterm did not help also.

I can start Ncurses normally if I use the library that ships with macOS or the library in home-brew.

@giordano
Copy link
Member

giordano commented Feb 1, 2020

You probably need to set the environment variable TERMINFINO_DIRS:

julia> using Ncurses_jll

julia> withenv("TERMINFO_DIRS" => joinpath(Ncurses_jll.artifact_dir, "share", "terminfo")) do
           ccall( (:initscr, libncurses), Cvoid, ())
       end

@giordano
Copy link
Member

giordano commented Feb 1, 2020

Also TERMINFO should work. In any case, it's better to wrap the calls in a withenv to avoid setting this variable for the whole Julia session

@ronisbr
Copy link
Author

ronisbr commented Feb 1, 2020

This work! However, I need to set for the whole Julia session, otherwise I will have to do a strange logic because I need to let the user to load its own ncurses version. Is there any downside?

@giordano
Copy link
Member

giordano commented Feb 1, 2020

This work!

Great, then I'm going to close the ticket.

Is there any downside?

The only problem can arise if there are other, different instances of ncurses loaded in the same session, that might be wrecked by this setting. The probability of this situation is likely very low. If all Julia packages needing ncurses use Ncurses_jll there will be no problem, of course.

You're free to set the variable with ENV["TERMINFO"], just be aware that if someone will complain about TextUserInterfaces.jl breaking other packages that use ncurses, that's likely the issue.

@giordano giordano closed this as completed Feb 1, 2020
@ronisbr
Copy link
Author

ronisbr commented Feb 1, 2020

Thanks very much for the quick help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants