Entries Tagged 'Ruby' ↓
August 20th, 2012 — Mac, Ruby
My last post on rbenv mentioned some things you need to do to get ruby to build on Mountain Lion. Here are a few more things.
This guy Jacob Swanner didn’t want to use either Xcode or gcc. He just used the Xcode command-line tools, with a
CC environment variable, thus:
$ CC=/usr/bin/clang rbenv install 1.9.3-p194
$ rbenv global 1.9.3-p194
That won’t work with older versions of Ruby, however, as I mentioned before.
I noted he is also a Homebrew user. I’m not yet ready to go there, although macports gets more and more frustrating with each OS release. (I’m not alone.) (But that’s a subject for some other time.)
And, for convenience, here’s another Homebrewer’s notes on how to get ruby building again with Mountain Lion
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:
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.)
February 8th, 2010 — Computers, Hobbies, Programming, Ruby
One of my frustrations as a casual Rubyist is trying to use some of these wonderful CPAN-like things that have appeared since I began playing with Ruby after the Hunt and Thomas article in Dr. Dobb’s. For example, gems.
The problem with Ruby (and especially rubygems) is that they don’t play nicely with the other package management tools on your system. (Ubuntu/Debian’s
.deb‘s and MacPorts‘ ports). And I’m too stupid and lazy to bypass all that and go back to using tarballs and stashing everything in
Enter RVM, the Ruby Version Manager. It bypasses your system’s package management system. It creates a hidden folder (
$HOME/.rvm) and puts whatever Ruby versions (and gems, etc.) there. But it does it all so cleverly you don’t realize what’s going on in the background. I like it.
October 12th, 2009 — Computers, Mac, Programming, Ruby
Thanks to my helpers at Google and Hive Logic, I was able to install Ruby on Snow Leopard.
It amazes me that so many Rubyists use the Mac, because it’s always a pain in the neck to get it set up right. You have to decide whether to use the stock version, or one from the MacPorts or Fink package managers. Note that your answer doesn’t just need to address Ruby but also the RubyGems extension library system. The problem with a black box is you have to trust the people who boxed it up.
Alternatively, you can just install from source, per the above instructions.
June 9th, 2009 — Hobbies, Latin, Life, Linux, Mac, Photos, Programming, Ruby
Since we finished Latin, my Mondays are pretty much free time for me. I spent yesterday writing some code. (I even wrote unit tests and put my changes under source control.)
Continue reading →
February 9th, 2009 — Language, Linux, Mac, Ruby, Technology, Typing, Writing
I’ve been looking for a software tool that would convert foreign characters into a poor substitute.
Call me Ugly McAmerican. I don’t care.
My language has been worn down — I would say, “polished” — like a river rock to the point where it doesn’t have a million characters or funny accent marks or any of that stuff. Now, I don’t mind if your language uses them. I don’t even mind if we have a common encoding. What I do mind is that none of my tools work with your stupid common encoding. When grep and sed and diff and ruby all know what to do with your ?q???????, give me a call.
In the meantime, I plan to go on working in ASCII as much as possible. Then, when necessary, I’ll use tools to convert ugly-quotes to pretty ones, or turn
... into ellipses, etc.
Continue reading →
November 14th, 2007 — Books, Hobbies, Programming, Ruby
If Amazon didn’t make it so hard to recommend buying a book from them, I’d post a link to Practical Ruby for System Administration. I purchased a copy a couple of weeks ago, and just finished reading it. You can find a sample chapter at the publisher’s site.
Continue reading →