Ruby ncursesw and OS X 10.6
I love my terminal, and consequently I enjoy using a variety of curses-based applications. Several of these are written in pure Ruby and take advantage of C bindings into the actual curses and terminfo functions needed.
Unfortunately, the "ncursesw" gem that's currently in Rubygems doesn't compile against the version of ncurses that's distributed with Mac OS X anymore. I used to run it just fine in the days of 10.4, but something has broken along the way.
In order to work around this breakage, I decided to take what's in MacPorts (which links just fine), only I didn't actually want to install MacPorts -- I'm a happy Homebrew user.
In order to use MacPorts without actually installing it, I downloaded the distribution tarball and extracted it:
curl -O 'https://distfiles.macports.org/MacPorts/MacPorts-2.0.3.tar.bz2' tar jxvf MacPorts-2.0.3.tar.bz2 cd MacPorts-2.0.3
And created a directory to act like a fake root directory:
mkdir fakeroot
Then, I used the autotools-generated "configure" script to re-point all paths into this "fakeroot" directory, and built everything:
./configure --prefix=/Users/jof/src/MacPorts-2.0.3/fakeroot make -j3 sudo make install
As of writing this creates a "macports" user and group, which I didn't much care for. So I got rid of them with:
sudo dseditgroup -o delete macports sudo dscl . -delete /Users/macports
I then setup my $PATH to reference the new "port" binary, got a working ports tree, and built a cross-arch ncurses library:
export PATH="${PWD}/fakeroot/bin:${PATH}" sudo port -v selfupdate sudo port install ncurses +universal
Now that's taken care of, I tried to build the ncursesw gem with an option to prepend optional paths passed to extconf.rb in the gem:
gem install ncursesw -- --with-opt-dir=/Users/jof/src/mp2/MacPorts-2.0.3/fakeroot
Finally, working Ncurses!











