<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Juju: Ruby 1.8.6 and Oniguruma on OSX</title>
    <link>http://juju.org/articles/2007/07/10/ruby-1-8-6-and-oniguruma-on-osx</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Sufficiently Advanced Technology</description>
    <item>
      <title>Ruby 1.8.6 and Oniguruma on OSX</title>
      <description>&lt;p&gt;I'm working on a project that requires some complicated regexes and for the first time actually needed to do a &lt;a href="http://www.regular-expressions.info/lookaround.html"&gt;look-behind&lt;/a&gt;.  Unfortunately, ruby 1.8.6 doesn't support it.  You can accomplish it using &lt;a href="http://www.geocities.jp/kosako3/oniguruma/"&gt;Oniguruma&lt;/a&gt; and Ruby 1.9 will come with it.  There's a &lt;a href="http://oniguruma.rubyforge.org/"&gt;gem&lt;/a&gt; but then you have to specficially reference it and might require code changes when 1.9 comes out(?), not to mention the fact that it's a pain in the ass to install on osx.  So I set out to figure out how to recompile ruby with it patched in.  The only info I could find in english was for ruby 1.8.5.  Finally figured it out, here's how (also works on linux, not just osx):&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6.tar.gz
tar xzvf ruby-1.8.6.tar.gz

curl -O http://www.geocities.jp/kosako3/oniguruma/archive/onigd2_5_9.tar.gz
tar xzvf onigd2_5_9.tar.gz
cd oniguruma
./configure --with-rubydir=../ruby-1.8.6
make 186

cd ../ruby-1.8.6
./configure --prefix=/usr/local --enable-pthread --with-readline-dir=/usr/local --enable-shared
make
sudo make install

ruby -e &amp;quot;puts Regexp::ENGINE&amp;quot; # should return Oniguruma&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
      <pubDate>Tue, 10 Jul 2007 14:26:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:1956f606-35dc-4e62-9c1f-d7e33142214d</guid>
      <author>Tony Buser</author>
      <link>http://juju.org/articles/2007/07/10/ruby-1-8-6-and-oniguruma-on-osx</link>
      <category>Code</category>
      <category>ruby</category>
      <trackback:ping>http://juju.org/articles/trackback/903</trackback:ping>
    </item>
  </channel>
</rss>
