Robby on Rails: Using MacPorts Ruby and Rails after Upgrading to OS X Leopardthoughts.sort_by{|t| t[:topic]}.collect tag:www.robbyonrails.com,2005:TypoTypo2007-10-27T05:52:50-04:00Robby Russellurn:uuid:4c96e766-87e4-41f4-9d7d-54fe826ed4e92007-10-27T05:43:00-04:002007-10-27T05:52:50-04:00Using MacPorts Ruby and Rails after Upgrading to OS X Leopard<p>If you previously followed my article, <a href="http://www.robbyonrails.com/articles/2007/06/19/installing-ruby-on-rails-and-postgresql-on-os-x-second-edition">Installing Ruby on Rails and PostgreSQL on <span class="caps">OS X</span>, second edition</a> and are now upgrading to <span class="caps">OS X</span> Leopard, you’ll want to make a few adjustments to your setup.</p>
<p>First of all, it’s great that Apple has decided to provide Ruby on Rails out of the box.</p>
<pre><code>
~ > gem list rails
*** LOCAL GEMS ***
rails (1.2.3)
Web-application framework with template engine, control-flow layer,
and ORM.
</code></pre>
How many gems does it come with?
<pre><code>
~ > gem list|grep '^[a-z]'|wc -l
29
</code></pre>
<p>It’s really great that <a href="http://apple.com">Apple</a> shipped Leopard pre-installed with 29 gems, especially if you don’t have your entire Rails stack setup already. In my case and for those that have followed my installation process, you don’t need to switch over to this new development stack (yet). I have a lot of time invested in my fully-functionaly MacPorts installation process (PostgreSQL, MySQL, RMagick, Subversion, Git, etc. Since this all working fine on my machine, I’m not ready to make the switch to Apple’s installation.</p>
<h2>Don’t Fix it… if it’s not broken!</h2>
<p>So, the the first thing that I did was modify my <code>PATH</code> environment variable, which has <code>/usr/bin</code> as the first path that it’ll look at when you try to run commands like <code>ruby</code>, <code>mongrel_rails</code>, <code>gem</code>, etc. You’ll want to modify this and prepend <code>/opt/local/bin:</code> to the front of <code>PATH</code> in your shell configuration. If you’re using bash, this would be… <code>~/.bashrc</code>. If you’re using zshell like me, <code>~/.zshrc</code>.</p>
<p>Now, when you start a new Terminal and run <code>gem list</code>, you’ll see all of the gems that you already have installed.</p>
<pre><code>
~ > gem list rails < new-host
*** LOCAL GEMS ***
rails (1.2.5, 1.2.4, 1.2.3, 1.1.6)
Web-application framework with template engine, control-flow layer,
and ORM.
</code></pre>
<p>Back to my happy gems…</p>
<pre><code>
~ > gem list|grep '^[a-z]'|wc -l < new-host
72
</code></pre>
<p>Great! Now I can get back to work and spend time playing with the new features in Finder, Mail.app, and iChat instead of installing all of the software dependencies that our development projects have. :-)</p><p>If you previously followed my article, <a href="http://www.robbyonrails.com/articles/2007/06/19/installing-ruby-on-rails-and-postgresql-on-os-x-second-edition">Installing Ruby on Rails and PostgreSQL on <span class="caps">OS X</span>, second edition</a> and are now upgrading to <span class="caps">OS X</span> Leopard, you’ll want to make a few adjustments to your setup.</p>
<p>First of all, it’s great that Apple has decided to provide Ruby on Rails out of the box.</p>
<pre><code>
~ > gem list rails
*** LOCAL GEMS ***
rails (1.2.3)
Web-application framework with template engine, control-flow layer,
and ORM.
</code></pre>
How many gems does it come with?
<pre><code>
~ > gem list|grep '^[a-z]'|wc -l
29
</code></pre>
<p>It’s really great that <a href="http://apple.com">Apple</a> shipped Leopard pre-installed with 29 gems, especially if you don’t have your entire Rails stack setup already. In my case and for those that have followed my installation process, you don’t need to switch over to this new development stack (yet). I have a lot of time invested in my fully-functionaly MacPorts installation process (PostgreSQL, MySQL, RMagick, Subversion, Git, etc. Since this all working fine on my machine, I’m not ready to make the switch to Apple’s installation.</p>
<h2>Don’t Fix it… if it’s not broken!</h2>
<p>So, the the first thing that I did was modify my <code>PATH</code> environment variable, which has <code>/usr/bin</code> as the first path that it’ll look at when you try to run commands like <code>ruby</code>, <code>mongrel_rails</code>, <code>gem</code>, etc. You’ll want to modify this and prepend <code>/opt/local/bin:</code> to the front of <code>PATH</code> in your shell configuration. If you’re using bash, this would be… <code>~/.bashrc</code>. If you’re using zshell like me, <code>~/.zshrc</code>.</p>
<p>Now, when you start a new Terminal and run <code>gem list</code>, you’ll see all of the gems that you already have installed.</p>
<pre><code>
~ > gem list rails < new-host
*** LOCAL GEMS ***
rails (1.2.5, 1.2.4, 1.2.3, 1.1.6)
Web-application framework with template engine, control-flow layer,
and ORM.
</code></pre>
<p>Back to my happy gems…</p>
<pre><code>
~ > gem list|grep '^[a-z]'|wc -l < new-host
72
</code></pre>
<p>Great! Now I can get back to work and spend time playing with the new features in Finder, Mail.app, and iChat instead of installing all of the software dependencies that our development projects have. :-)</p>