Install ruby-2.0.0-p195 using rbenv, ruby-build and pkg-config

Ruby, Rails, news of new versions. Your computer’s Homebrew and ruby-build installation does not work. Something’s borked. It worked on the other people’s Debian machines. Your Homebrew system gave you… output. Some obscure error about openssl?

You search. You whine. You arrive here. Breathe.

Requirements: rbenv, ruby-build, a Ruby 2.0.0-p195 refuses to install on account of missing header files for openssl, since the Apple-bundled version is outdated.

TL;DR:

Add this at the end of your shell startup file (such as ~/.bash_profile or ~/.zshrc). Then run the installation again.

export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:/usr/local/lib/pkgconfig

Learn how!

In order to share more of the fact-finding process, here is some narrative. All credit is due to Stuge. He told me to read, it would work. Thanks! He was right, too. It did work.

First of all, pkg-config is a neat little program. It’s the hero of this narrative. Does all the heavy archiving, noting things down, so you don’t have to.


pkg-config --debug

This lists everything that pkg-config knows about header file locations, libraries, compilation configuration settings about the libs on your system.

Begin by ensuring there is a PKG_CONFIG_PATH on your system, that points to where the currently-symlinked Homebrew packages are. Add this to your shell startup:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

Well, this is half-way, pkgconfig can now find most of its .pc files.

The specific complaint was about openssl. Let’s go to its folder, using brew:


$ cd `brew --prefix openssl`

Now, are there any pkg-config files around? Use find:


$ find . -name '*.pc'
./lib/pkgconfig/libcrypto.pc
./lib/pkgconfig/libssl.pc
./lib/pkgconfig/openssl.pc

Ah-hah!


$ cd lib/pkgconfig
$ pwd
/usr/local/opt/openssl/lib/pkgconfig

This is the path where our pkg-config descriptions sit. Pre-pend it to its path!


export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:/usr/local/lib/pkgconfig

Thusly, the desired result:


$ ruby-build 2.0.0-p195 ~/.rbenv/versions/2.0.0-p195
Downloading ruby-2.0.0-p195.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p195.tar.gz
Installing ruby-2.0.0-p195...
Installed ruby-2.0.0-p195 to /Users/olle/.rbenv/versions/2.0.0-p195

The end.

Addendum for web-crawling robots

(The obscure error mentioned at the start included here for searchability.)


rbenv install 2.0.0-p0
Downloading ruby-2.0.0-p0.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz
Installing ruby-2.0.0-p0...

BUILD FAILED
Inspect or clean up the working tree at /tmp/ruby-build.20130506102349.2564
Results logged to /tmp/ruby-build.20130506102349.2564.log
Last 10 log lines:
installing default gems: /home/shivin/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0 (build_info, cache, doc, gems, specifications)
bigdecimal 1.2.0
io-console 0.4.2
json 1.7.7
minitest 4.3.2
psych 2.0.0
rake 0.9.6
rdoc 4.0.0
test-unit 2.0.0.0
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?

Kod100: Document a very old project

#kod100 is a thing. In Sweden. “Do FOSS stuff for a hundred consecutive days.” Keeping a log of it is optional. So, I’m dusting off WordPress. And trying.

Things experienced in this session:

Use the wp-cli command-line tool to manage WordPress. Until it’s completely package-stable, use it from the Git repository. Fine instructions at their homepage.

And, for ergonomy, I added syntax highlighting in less.

Also began the actual project, by using git-svn to pull a repo copy onto GitHub. The shared Subversion repository for all PHP extensions has quite a few revisions. Too many! A pull from the top will be more effective, I guess.

Goal of project: add some documentation to one of the oldest still-living PHP extensions: stats. Most of it is just hard to understand, since I’m no math head.

Colonist!

I have begun planting vegetables at a good spot called Valdemarsro. My town Malmö owns most of the allotment plots available, around 5000 of them. “Awe-inspiring”, my Canadian friend remarked.

To get your own allotment plot in Malmö, get in line at the municipality’s website. It costs between 450-650 SEK for a year.

This is a quaint PDF map of the Valdemarsro plots.

Allotment plot gardens are full of characters – and I love chatting with them. Two men I spoke to had been on that ground for 24 and 28 years, respectively. They share wisdom and victories happily. All men I talk to are of Eastern European descent, perhaps Polish. Gentlemen, all.

I note that Malmö is the oldest allotment tradition in Sweden. It begun in 1895. The union of allotment plot associations is called KoloniträdgÃ¥rdsförbundet. (There’s another wonderful union above that! They have their own campaign against snails.)

See also The Victorian Kitchen Garden, a fine piece of Swedish-English collaboration in televisual entertainment of the Olde kind.

http://www.youtube.com/watch?v=XXO4mAY8tGI

the freedom of the copy party

In The working class of computer art GOTO80 talks about demoscene parties:

What is the point? Well, I really like the freedom of the copy party. Think of it as a hackerspace disco with lots of man-beer and old music. There’s no money and no bullshit. You don’t have to network with the right people and explain your work on their terms. It’s an odd soup of CEOs, graffiti writers, headmasters, schizophrenics and academics that is hard to find elsewhere. Some people are just quiet and make music, others are fixing some hardware while the Finnish BBS-d00d is puking in the closet. Then they all crash on the floor, covered in data noise. It’s like being 16 again all over, except for the SD-cards.

Hackerspace disco!

sl and sl: Useless/useful

The command ls lists files in current directory in many ways. Misspelling it as sl is common. Common enough to make an ASCII joke about it. Linux distribution Debian packages sl as this ASCII joke.

Debian's package screenshot

Today, Trivium pointed to a much better and brand-new sl.

sl takes the most common use of Unix ls, to display the files in a directory compactly in multiple columns, and makes it substantially more useful.

Right. Take a look at those screenshots, a long look. More information per square-centimeter.

Steps to get this in your MacOS X machine (which in my case is an old 10.5):

  • get Tcl8.5 installed
  • Installing it would be something like gnumake all; gnumake install
  • download the sl script into your path
  • chmod the sl script to be executable
  • Update: Be really surprised when it looks like ls, finding out it was an alias from Oh My Zsh. Remove the alias in the ~/.oh-my-zsh/lib/aliases.zsh file
  • change the sl shebang script line to the new /usr/local/bin/tclsh

A recipe like this sounds like a package management task. Robots are our friends.

This code is not yet packaged or pull-requested in Mac Homebrew, which also uses the ASCII animation for its sl. Sadly, brew search tcl does nothing useful, either. This is a time for heroes.

Get pman: man pages for PHP functions

This link post is quite irrelevant should you never be using PHP. Therefore, I categorized it.

Published in 2010, Unix manual pages for PHP functions is still a useful tip.

A decade of using Python, and you don’t ask yourself where the argument goes in a function you use daily. Experienced PHP developers look at the php.net website quite a lot. Print cheatsheets (but never look at them, since the php.net website exists).

“There’s a quicker way.” You look up a trick on the Internet. In this case it was long-time PEAR committer cweiske who pointed this out.


pear channel-discover doc.php.net
pear channel-update doc.php.net
pear install doc.php.net/pman

or, if your setup forces you to use sudo (for your copy-and-pasting pleasure):


sudo pear channel-discover doc.php.net
sudo pear channel-update doc.php.net
sudo pear install doc.php.net/pman

This downloads five megabytes of PHP documentation, and a small command-line utility that fires up your text viewer.

Result: any PHP function can be looked up locally, in your viewer: pman strpos

Thanks, Bjori!

TBD Hackathon 2012 participant report

I spent the weekend at TBD 2012 Hackathon in a coffee shop in Malmö. I know part of the organizing team, and it was nearby, so I joined in, for the feeling of the fast-paced making.

Update: If you met me at the hackathon, say hello in the comments. Or on Twitter, I’m olleolleolle. Kthxbye!

Jens describes his experience at his blog. Wired wrote an unrelated but explanatory What is a hackathon? piece, for your understanding pleasure.

This was the shape of the event:

  • initial 30-second “who I am” introductions from each person in the room,
  • then project pitches to recruit groups,
  • then working on those projects,
  • then working on those projects,
  • and then one hour of demos on Sunday.

I presented myself and mentioned that I had forgot to bring my Arduinos. Turns out, that platform is as popular as its huge mindshare would suggest. I joined a team that already had an electronics gizmo (candy dispenser that you tweet to) and a software prototype running. Cheating? Perhaps. The ground rules need to be more clear on where teams start, I think. Example fix: “No pre-made teams. No pre-existing software.”

The work I did for the project was mostly software quality-related. Moved code, deleted code, renamed things, added a few tests. And I made a very small documentation website using Jekyll and the Twitter Bootstrap CSS. The project presented a how-to document, but not a fully described protocol. We sharpened the prototype.

When Sunday rolled around, and demo time at 17:00 was nearing, our project instigator opened a bottle of champagne, and took some pictures. Psyching other teams? There was a schedule change, and suddenly we could lounge until 18:00, the new demo start time.

It went well: we shared the second place with Jens’ group. The winner was a quite useful project, but it does not yet have any useful web presence.

Cheer: Highlights of the weekend

Met great locals. People were open to talking, and were helpful.

Met great people who were not like me. Graying men in business casual. Generation gap can be a challenge, but this event had no “cost of contact”.

The event had a kid-friendly atmosphere. Kids playing Minecraft, controlling a blimp, et cetera. Participating instead of irritating. Perhaps this explains best: “Dad, can you install the latest beta of the client for me?”

My team was very kind and cheerful, too. I was welcomed into a team of friends as a peer. Thanks.

The place and the logistics and the sponsors made the event feel very privileged. High-functioning.

Challenges: Stuff we need to do better

Here is a short list of stuff I know all new communities have to contend with. I want this to be a successful community, so I share my mild concerns here.

Shyness is real. Enabling shy people to interact on their own terms is hard. Try to think of that when designing a social event.

Avoid popularity contests. I would like your thoughts on how to avoid the popularity contest of choosing teams. Perhaps it is enough to describe the process of Recuiting A Team For Your Problem: “You will have to gather a team, and that’s no walk in the park. Here are the vital information you need to put out in your project pitch.” What do you think?

Don’t be a software ghetto. Actively pursue involvement by groups outside the “existing set of hackers we know”. The ghetto feeling can make the events irrelevant. Danish event Demodag is great at this.

Keep everyone in the loop. If there is a comment track, or a back-channel, make sure everyone knows about it to avoid risking missed opportunities. (I joined the #tbd2012 IRC channel, on freenode, just to see whether anyone else had. They hadn’t, so not a problem there.)

Continuity: I want more of this

I like this event, and I want this community to flourish. Sowing those seeds:

Personal prep: Keep a personal list of hackable problems and technologies, to remain prepared.

Technology radar (here one by ThoughtWorks) are personal, meaningful to a person or to a group, not to a whole culture. So, you tiny list, is useful to you.

On that note, I’m going to try and make one of those, using some mix of technologies I agree with. And, I am going to tell you about the 14th Demodag. Another day. Ciao!