<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>it's a ruby thing - Howto</title>
  <id>tag:its.arubything.com,2008:mephisto/howto</id>
  <generator version="0.7.3" uri="http://mephistoblog.com">Mephisto Noh-Varr</generator>
  <link href="http://its.arubything.com/feed/howto/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://its.arubything.com/howto" rel="alternate" type="text/html"/>
  <updated>2007-08-30T04:27:02Z</updated>
  <entry xml:base="http://its.arubything.com">
    <author>
      <name>brandon.dimcheff</name>
    </author>
    <id>tag:its.arubything.com,2007-08-28:2</id>
    <published>2007-08-28T03:52:00Z</published>
    <updated>2007-08-30T04:27:02Z</updated>
    <category term="Howto"/>
    <category term="gem"/>
    <category term="install"/>
    <category term="macports"/>
    <category term="mysql"/>
    <category term="rails"/>
    <link href="http://its.arubything.com/2007/8/28/installing-a-rails-stack-on-mac-os-x-with-macports" rel="alternate" type="text/html"/>
    <title>Installing a Rails stack on Mac OS X with MacPorts</title>
<content type="html">
            &lt;p&gt;I have a clean install of OS X on which I need to install Rails.  I&#8217;ve done this maybe 3 or 4 times in the past year with minor variations each time which inevitably come back to bite me later.  This post is an effort to document and standardize all the details to get a Rails stack going with MacPorts.&lt;/p&gt;

&lt;h2&gt;Installing Xcode Tools&lt;/h2&gt;

&lt;p&gt;You need the latest version of &lt;a href=&quot;http://developer.apple.com/tools/xcode/&quot;&gt;Xcode tools&lt;/a&gt; to be able to compile all the packages necessary for Ruby and Rails.  They&#8217;re a free download from Apple.&lt;/p&gt;

&lt;h2&gt;Installing MacPorts&lt;/h2&gt;

&lt;p&gt;First thing&#8217;s first: Install &lt;a href=&quot;http://trac.macosforge.org/projects/macports/wiki/InstallingMacPorts&quot;&gt;MacPorts&lt;/a&gt;! Be sure to follow the directions closely.  Especially the bit about setting your &lt;code&gt;PATH&lt;/code&gt; appropriately.  The /opt paths must be before your standard path so when you type &lt;code&gt;ruby&lt;/code&gt;, you use the ruby interpreter from MacPorts rather than the old one that came with OS X.&lt;/p&gt;

&lt;h2&gt;Installing Rails Prerequisites with MacPorts&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;$ sudo port install mysql5 +server
$ sudo port install ruby
$ sudo port install rb-rubygems
$ sudo port install rb-mysql
$ sudo port install rb-termios
$ sudo port install subversion +tools
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Configure MySQL&lt;/h2&gt;

&lt;p&gt;First, add &lt;code&gt;/opt/local/lib/mysql5/bin/&lt;/code&gt; to your &lt;code&gt;PATH&lt;/code&gt; as you did in the instructions to install MacPorts.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ sudo mysql_install_db5 --user=mysql
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Install Gems&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;$ sudo gem install -y rake
$ sudo gem install -y rails
$ sudo gem install -y capistrano
$ sudo gem install -y mongrel
$ sudo gem install -y mongrel_cluster
$ sudo gem install -y piston
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Install Optional Packages&lt;/h2&gt;

&lt;p&gt;The above ports and gems are the minimum you&#8217;ll need to get rails running successfully.  The ones below, while not required, are often useful when developing rails apps.&lt;/p&gt;

&lt;h3&gt;Other Databases&lt;/h3&gt;

&lt;p&gt;Try postgres or sqlite3 for some database variety (&lt;code&gt;port install postgresql82-server &amp;amp;&amp;amp; port install rb-postgres&lt;/code&gt; or &lt;code&gt;port install rb-sqlite3&lt;/code&gt;, respectively).&lt;/p&gt;

&lt;h3&gt;Testing&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://rspec.rubyforge.org/&quot;&gt;RSpec&lt;/a&gt; - a powerful &lt;a href=&quot;http://en.wikipedia.org/wiki/Behavior_driven_development&quot;&gt;BDD&lt;/a&gt; framework&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://flexmock.rubyforge.org/&quot;&gt;Flexmock&lt;/a&gt; and/or &lt;a href=&quot;http://mocha.rubyforge.org/&quot;&gt;Mocha&lt;/a&gt; - for mocking/stubbing&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Misc&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://tzinfo.rubyforge.org/&quot;&gt;tzinfo&lt;/a&gt; - Time Zone handling&lt;/li&gt;
&lt;/ul&gt;
          </content>  </entry>
</feed>
