August 18th, 2012 — Computers, Ruby
I used to use rvm to manage my ruby environment, but the latest hotness seems to be rbenv. Here are some tips about using it. They’re aimed at me, because by the next time I need to use it, I’ll have forgotten. But you can read them too:
One of the things you want is rbenv-build:
Installing ruby-build as an rbenv plugin will give you access to the rbenv install command.
$ mkdir -p ~/.rbenv/plugins
$ cd ~/.rbenv/plugins
$ git clone git://github.com/sstephenson/ruby-build.git
(Note the assumption you’re using git. I don’t know what people who prefer mercurial are supposed to do.)
This will install the latest development version of ruby-build into the ~/.rbenv/plugins/ruby-build directory. From that directory, you can check out a specific release tag. To update ruby-build, run
git pull to download the latest changes.
But that won’t work with Mountain Lion. So you’ll need a version of ruby that can be built with clang.
$ rbenv install 1.9.3-p125
June 12th, 2012 — Mac, Ruby
When Apple switched from GCC to LLVM in Xcode 4.2, they made it significantly more difficult for me to run ruby 1.9.2. (What are the odds this will get easier with Mountain Lion?)
I was using rbenv and its rbenv-build plugin to install ruby 1.9.2 and it told me this:
$ rbenv install 1.9.2-p320
ERROR: This package must be compiled with GCC, but ruby-build couldn't
find a suitable `gcc` executable on your system. Please install GCC
and try again.
DETAILS: Apple no longer includes the official GCC compiler with Xcode
as of version 4.2. Instead, the `gcc` executable is a symlink to
`llvm-gcc`, a modified version of GCC which outputs LLVM bytecode.
For most programs the `llvm-gcc` compiler works fine. However,
versions of Ruby older than 1.9.3-p125 are incompatible with
`llvm-gcc`. To build older versions of Ruby you must have the official
GCC compiler installed on your system.
TO FIX THE PROBLEM: Install the official GCC compiler using these
You will need to install the official GCC compiler to build older
versions of Ruby even if you have installed Apple's Command Line Tools
for Xcode package. The Command Line Tools for Xcode package only
Note: when you install that, it doesn’t (appear to) provide an uninstaller. Instead it says this:
If something doesn’t work as expected, feel free to install Xcode over this installation.
Once installed, you can remove Xcode completely with the following:
sudo /Developer/Library/uninstall-devtools –mode=all
Bummer for me, huh? Mercifully, the GCC installation package doesn’t mess up the llvm-gcc link in
/usr/bin/gcc. But that means when I do the ruby build, I need to add:
May 25th, 2011 — Programming
For the most part, moving to Ruby 1.9 was pretty simple (apart from the FasterCSV issue). Today I stumbled on another problem, though: the current directory isn’t in your RUBYLIB path by default. Well.
April 14th, 2011 — Programming, RSI
I ran across this nice reflection on the vim editor by someone who switched 18 months ago. In my own case, it was about 18 years. I’d been an emacs user forever, and it was just killing me (carpal tunnel, tennis elbow, and who-knows-what). So I made the switch to vi (and, soon enough, vim). It took awhile to get used to modes, but the alternative is playing Twister with my ring and pinky fingers.
November 16th, 2010 — Computers, Programming
I might have posted too soon yesterday. My irb incorporates readline now, but it appears to honor only emacs keybindings. Bummer, huh? I used to be an emacs user, so I can get by for now, but I’d really like to figure out how to get vi keybindings.
November 15th, 2010 — Computers, Programming, Ruby
On the Mac, irb doesn’t come with readline baked in. But you can fix that with
$ rvm install 1.8.7 -C \
Kudus: Plataformatec, who uses Homebrew and thus /usr/local rather than /opt/local.
November 13th, 2010 — Computers, Hobbies, Office, Programming, Recreation, Ruby
A while ago, Google bought the company that made Freebase, a tool for making sense of messy data. Earlier this week, they released a 2.0 version of that software, now renamed Google Refine. Watch the videos to see what that does.
This looks pretty darned impressive. For great chunks of my career, I’ve been doing work like that the hard way. In the 1980s, I started my career by doing data reduction in Fortran, but quickly graduated to sed and awk, and in the 2000s I used perl and ruby. Of course, when I say “the hard way,” that is in hindsight. Each of those was an improvement over what I used before, and this looks like it could be a similar type of improvement.
(I still do some of that kind of work even now. It’s been a couple of years, but I probably spent at least a week, spread across too many evenings and weekends, massaging the church directory from a text format Word document into tabular spreadsheet data.)