Installing ncurses for ruby on Windows

前端 未结 7 1998
不思量自难忘°
不思量自难忘° 2021-01-13 01:38

I am trying to install ncurses for ruby on windows. I have not installed ncurses before on my machine. I thought that having the \"ruby devkit\", it had asked for would be e

相关标签:
7条回答
  • 2021-01-13 02:06

    I've managed to do it for ruby 2.2, which doesn't come with curses by default, but it took me a while:

    • Download PDCurses from SourceForge;
    • Unzip it;
    • Copy it's contents to a folder where ruby can see it. I'm not sure which one I used, I think I copied it to multiple ones until it worked. ruby -e 'puts $:' might help;
    • Install curses, gem instal curses. If the previous step was wrong, this will fail;
    • Done :D

    This method didn't work for other gems, like ffi-ncurses. Tip: most of curses functionality comes from the Window class, which comes with curses by default.

    0 讨论(0)
  • 2021-01-13 02:13

    The ruby ncurses gem requires that ncurses in installed on the machine. As far as I know ncurses has not been ported to windows. So I don't think you are going to get this to work.

    There may be other ways to find out how wide the screen is on windows but I can't help you with that.

    0 讨论(0)
  • 2021-01-13 02:18

    Update: It seems like SourceForge no longer hosts NCurses binaries for Windows. This answer is effectively obsolete now. Sorry! (As of August 2015, the GNU NCurses Page lists a "new" v6.0 release, which is newer than the 0.9.1 version in my answer.)

    I finally got this to work (years after I needed it ...) without Cygwin, PDCurses, or manually building the NCurses source. The instructions are available on my blog. For reference:

    • Download the latest NCurses binaries (0.9.1) from SourceForge.
    • Unzip the files somewhere on your machine.
    • Find out where Ruby searches for libraries by running ruby -e 'puts $:'
    • Copy and paste ncurses.so and lib\ncurses.rb from the NCurses directory into the directory you picked. Place them both in the root directory.
    • Run your NCurses-enabled app.

    It works. Without PDCurses!

    0 讨论(0)
  • 2021-01-13 02:18

    As of February 2020 (and possibly earlier) you can install the ncurses lib with

    gem install curses
    

    It works without any problems, at least on Ruby 2.6.5

    0 讨论(0)
  • 2021-01-13 02:22

    When gem installed needs for curses lib; so at first you need to install NCurses with your msys2

    https://sourceforge.net/p/mingw-w64/wiki2/NCurses/

    Download NCurses (v5.9 at the time of writing): http://ftp.gnu.org/pub/gnu/ncurses/ in the source directory

    Then untar and in the MSYS shell:

    ./configure --host=x86_64-w64-mingw32 --enable-term-driver --enable-sp-funcs --prefix=/some/prefix

    make

    make check

    make install

    then as mentioned in the link : https://github.com/ruby/curses/issues/13

    use --platform=ruby ,--with-curses-include ,--with-curses-lib flags with gem install

    0 讨论(0)
  • 2021-01-13 02:28

    Updated version:

    1. Get ncurses (MinGW Port): http://invisible-island.net/ncurses/
    2. Put it in C:\ncurses
    3. gem install curses --platform=ruby -- --with-ncurses-dir="C:\ncurses"
    4. Copy the contents of C:\ncurses\bin to somewhere in your path

    C:\ncurses can be any directory

    0 讨论(0)
提交回复
热议问题