<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Ruby on Stay Frosty</title><link>https://frosty.blog/tags/ruby/</link><description>Recent content in Ruby on Stay Frosty</description><generator>Hugo -- gohugo.io</generator><language>en-gb</language><copyright>© James Frost</copyright><lastBuildDate>Mon, 02 Jun 2008 23:00:00 +0000</lastBuildDate><atom:link href="https://frosty.blog/tags/ruby/index.xml" rel="self" type="application/rss+xml"/><item><title>Building Ruby 1.9 on Mac OS X 10.5 (Leopard)</title><link>https://frosty.blog/2008/06/02/building-ruby-1-9-on-mac-os-x-10-5-leopard/</link><pubDate>Mon, 02 Jun 2008 23:00:00 +0000</pubDate><guid>https://frosty.blog/2008/06/02/building-ruby-1-9-on-mac-os-x-10-5-leopard/</guid><description>&lt;p&gt;I&amp;rsquo;ve recently been learning Ruby, and I wanted to install Ruby 1.9 on OS X to try out some of the new features (the current &amp;lsquo;stable&amp;rsquo; version of Ruby is 1.8.6). Unfortunately, I couldn&amp;rsquo;t find one cohesive guide to doing this, and instead had to mash together various instructions from across the interwebs. I&amp;rsquo;ve pieced everything together here in the hope that it&amp;rsquo;ll help out someone else. :-)&lt;/p&gt;
&lt;h3 id="step-1"&gt;Step 1&lt;/h3&gt;
&lt;p&gt;Firstly, readline needs updating, so grab readline 5.2 from &lt;a href="http://ftp.gnu.org/gnu/readline/"&gt;http://ftp.gnu.org/gnu/readline/&lt;/a&gt;. After extracting it (&lt;code&gt;tar xvzf readline-5.2.tar.gz&lt;/code&gt;) you&amp;rsquo;ll need to make one or two changes so that it will build correctly on Leopard. Simply apply this &lt;a href="http://www.ruby-forum.com/topic/136498#607592"&gt;readline patch&lt;/a&gt; to support/shobj-conf in the readline directory you&amp;rsquo;ve created. The patch is necessary because readline currently doesn&amp;rsquo;t check for Leopard, only for earlier versions of OS X. In fact, the patch is simple enough that you could change the two lines by hand if necessary.&lt;/p&gt;</description><content:encoded><![CDATA[<p>I&rsquo;ve recently been learning Ruby, and I wanted to install Ruby 1.9 on OS X to try out some of the new features (the current &lsquo;stable&rsquo; version of Ruby is 1.8.6). Unfortunately, I couldn&rsquo;t find one cohesive guide to doing this, and instead had to mash together various instructions from across the interwebs. I&rsquo;ve pieced everything together here in the hope that it&rsquo;ll help out someone else. :-)</p>
<h3 id="step-1">Step 1</h3>
<p>Firstly, readline needs updating, so grab readline 5.2 from <a href="http://ftp.gnu.org/gnu/readline/">http://ftp.gnu.org/gnu/readline/</a>. After extracting it (<code>tar xvzf readline-5.2.tar.gz</code>) you&rsquo;ll need to make one or two changes so that it will build correctly on Leopard. Simply apply this <a href="http://www.ruby-forum.com/topic/136498#607592">readline patch</a> to support/shobj-conf in the readline directory you&rsquo;ve created. The patch is necessary because readline currently doesn&rsquo;t check for Leopard, only for earlier versions of OS X. In fact, the patch is simple enough that you could change the two lines by hand if necessary.</p>
<p>Then, configure readline, specifying a location so you don&rsquo;t interfere with what&rsquo;s already on your system, then build and install it:</p>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">./configure --prefix<span class="o">=</span>/usr/local/
</span></span><span class="line"><span class="cl">make
</span></span><span class="line"><span class="cl">sudo make install</span></span></code></pre></div><h3 id="step-2">Step 2</h3>
<p>Next, you&rsquo;ll want to download Ruby 1.9: <a href="http://ftp.ruby-lang.org/pub/ruby/1.9/">http://ftp.ruby-lang.org/pub/ruby/1.9/</a>. Again, we want to specify our own install location, and we also need to tell it where our newly installed readline is. We&rsquo;re also specifying a program-suffix here (-trunk) so we can differentiate Ruby 1.9 from our pre-installed Ruby (so we&rsquo;ll access 1.9 with ruby-trunk, irb-trunk, etc, and 1.8.6 with ruby, irb, etc).</p>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">tar xvzf ruby-1.9.0-1.tar.gz
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> ruby-1.9.0-1
</span></span><span class="line"><span class="cl">./configure --prefix<span class="o">=</span>/usr/local/ruby1.9 --program-suffix<span class="o">=</span>-trunk --with-readline-dir<span class="o">=</span>/usr/local --
</span></span><span class="line"><span class="cl">make
</span></span><span class="line"><span class="cl">sudo make install</span></span></code></pre></div><h3 id="step-3">Step 3:</h3>
<p>Finally, because we&rsquo;ve installed Ruby in a specific location, you&rsquo;ll most likely need to add its location to your path. I have a bin/ directory in my home directory, so I simply have the following line in my .bash_profile:</p>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Add Ruby 1.9</span>
</span></span><span class="line"><span class="cl"><span class="nv">PATH</span><span class="o">=</span><span class="nv">$PATH</span>:/usr/local/ruby1.9/bin</span></span></code></pre></div><p>And you&rsquo;re done. You can test by running <code>ruby-trunk --version</code>. Any problems, sound off in the comments. I may have missed something, as it&rsquo;s rather late - and I could&rsquo;ve almost certainly written this better. Hopefully I&rsquo;ll revisit it in the future. If you get stuck, the articles I used to put this together might be of use:</p>
<ul>
<li><a href="http://lindsaar.net/2008/1/18/installing-ruby-1-9-on-mac-osx">Installing Ruby 1.9 on Mac OSX</a></li>
<li><a href="http://www.ruby-forum.com/topic/136498">Trouble with readline and building Ruby 1.9</a></li>
<li>Also, thank you to Han Kessels for helping me via e-mail.</li>
<li>And I&rsquo;m sure there were some other sites, that I can&rsquo;t recall at the moment.</li>
</ul>
]]></content:encoded></item></channel></rss>