<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Seaside &#187; Infrastructure</title> <atom:link href="http://blog.blackwhale.at/category/infrastructure/feed/" rel="self" type="application/rss+xml" /><link>http://blog.blackwhale.at</link> <description>A weblog by Blackwhale about design, code and random stuff we care about.</description> <lastBuildDate>Tue, 10 Aug 2010 15:29:48 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0.1</generator> <item><title>How to set up your Mac for Rails Development</title><link>http://blog.blackwhale.at/2009/09/set-up-your-mac-for-rails-development/</link> <comments>http://blog.blackwhale.at/2009/09/set-up-your-mac-for-rails-development/#comments</comments> <pubDate>Tue, 15 Sep 2009 15:18:37 +0000</pubDate> <dc:creator>Christian</dc:creator> <category><![CDATA[Infrastructure]]></category> <category><![CDATA[ImageMagick]]></category> <category><![CDATA[Leopard]]></category> <category><![CDATA[Mac OS X]]></category> <category><![CDATA[MacPorts]]></category> <category><![CDATA[Phusion Passenger]]></category> <category><![CDATA[PostgreSQL]]></category> <category><![CDATA[Ruby on Rails]]></category> <category><![CDATA[rubygems]]></category> <category><![CDATA[Snow Leopard]]></category> <category><![CDATA[SQLite3]]></category> <category><![CDATA[SSH Keys]]></category> <category><![CDATA[TextMate]]></category><guid
isPermaLink="false">http://blog.blackwhale.at/?p=175</guid> <description><![CDATA[<p>In this post I will guide you through everything necessary to get your freshly set up Mac ready for Ruby on Rails Development.</p><p>Things we'll install:</p><ul><li><a
href="#Xcode">Xcode</a></li><li><a
href="#MacPorts">MacPorts</a><ul><li>Git</li><li>Ruby</li><li>SQLite3</li><li>ImageMagick</li></ul></li><li><a
href="#TextMate">TextMate</a></li><li><a
href="#Passenger">Phusion Passenger</a></li><li><a
href="#SSH-Keys">SSH Keys</a></li></ul>]]></description> <content:encoded><![CDATA[<p>In this post I will guide you through everything necessary to get your freshly set up Mac &#8212; using Leopard or Snow Leopard &#8212; ready for Ruby on Rails Development.</p><p>Things we&#8217;ll install:</p><ul><li><a
href="#Xcode">Xcode</a></li><li><a
href="#MacPorts">MacPorts</a><ul><li>Git</li><li>Ruby</li><li>SQLite3</li><li>ImageMagick</li></ul></li><li><a
href="#PostgreSQL">PostgreSQL</a></li><li><a
href="#TextMate">TextMate</a></li><li><a
href="#Passenger">Phusion Passenger</a></li><li><a
href="#SSH-Keys">SSH Keys</a></li></ul><p><span
id="more-175"></span></p><h3><a
name="Xcode">Xcode Tools</a></h3><p>Install XCode Tools from your MacOS Install Disc&#8217;s &#8220;Optional Installs&#8221; Folder:</p><p><img
src="http://blog.blackwhale.at/wp-content/uploads/2009/07/Optional-Installs.png" alt="Install Xcode from your Mac OS X Install disc&#039;s &#039;Optional Installs&#039; folder" title="optional installs" width="512" height="156" class="size-full wp-image-410" /></p><p>Or, if you don&#8217;t have your Mac OS Install disc handy, you can download the latest version of Xcode Tools from <a
href="http://developer.apple.com/technology/Xcode.html">Apple Developer Connection</a> (free Registration required).</p><h3><a
name="MacPorts">MacPorts</a></h3><p>Get the latest version from the <a
href="http://www.macports.org/install.php">MacPorts</a> site. Download the disk image for your version of Mac OS X and install MacPorts.</p><p>After the installation is complete, open a Terminal and make sure that the <code>port</code> command is available by reloading <code>/etc/profile</code>:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">. <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>profile</pre></div></div><p>Update your ports database using</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> port selfupdate</pre></div></div><p>Then, install all the necessary ports:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> port <span style="color: #c20cb9; font-weight: bold;">install</span> git-core +<span style="color: #c20cb9; font-weight: bold;">svn</span> ruby rb-rubygems sqlite3 ImageMagick</pre></div></div><h3><a
name="PostgreSQL">PostgreSQL</a></h3><p>While MacPorts is building and installing packages, download <a
href="http://postgresqlformac.com/lists/downloads/unified_installer_disk_imag/">PostgreSQL for Mac</a> and start the &#8216;PostgreSQL for Mac&#8217; installer in the &#8216;Server&#8217; directory.</p><p><img
src="http://blog.blackwhale.at/wp-content/uploads/2009/07/Server.png" alt="Install PostgreSQL Server" title="Install PostgreSQL Server" width="515" height="416" class="alignnone size-full wp-image-402" /></p><p>After installing PostgreSQL Server, add a database role for your user account:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-u</span> postgres <span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>PostgreSQL8<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>createuser</pre></div></div><p>Enter your Mac OS X system user name as role name, and make it a superuser.</p><p><img
src="http://blog.blackwhale.at/wp-content/uploads/2009/07/Terminal-—-zsh-—-⌘3.png" alt="Add postgres user role" title="Add postgres user role" width="471" height="84" class="alignnone size-full wp-image-403" /></p><h3><a
name="TextMate">TextMate</a></h3><p>Download and install the latest version from the <a
href="http://macromates.com">TextMate</a> site.</p><h4>TextMate Bundles</h4><p>To make sure that the bundle installation runs smoothly, make sure that the <code>Bundles</code> directory exists on your machine:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles</pre></div></div><p>Install Bundles for Git, Ruby on Rails, RSpec, Cucmber, Webrat, Sass and Haml:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>timcharper<span style="color: #000000; font-weight: bold;">/</span>git-tmbundle.git ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>Git.tmbundle
git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>drnic<span style="color: #000000; font-weight: bold;">/</span>ruby-on-rails-tmbundle.git ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>Ruby\ on\ Rails.tmbundle
git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>dchelimsky<span style="color: #000000; font-weight: bold;">/</span>rspec-tmbundle.git ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>RSpec.tmbundle
git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>bmabey<span style="color: #000000; font-weight: bold;">/</span>cucumber-tmbundle.git ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>Cucumber.tmbundle
git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>bmabey<span style="color: #000000; font-weight: bold;">/</span>webrat-tmbundle.git ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>Webrat.tmbundle
git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>aussiegeek<span style="color: #000000; font-weight: bold;">/</span>ruby-sass-tmbundle.git ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>Ruby\ Sass.tmbundle
git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>canadadrugs<span style="color: #000000; font-weight: bold;">/</span>ruby-haml-tmbundle.git ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>Ruby\ Haml.tmbundle</pre></div></div><p>You can also install my TextMate bundle containing commands to restart Passenger, reformat Ruby code and update all your bundles via Git:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>inz<span style="color: #000000; font-weight: bold;">/</span>inz-tmbundle.git ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>inz.tmbundle</pre></div></div><p>Finally, tell TextMate to reload all bundles:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">osascript <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'tell app &quot;TextMate&quot; to reload bundles'</span></pre></div></div><h3>Rubygems</h3><p>Make sure you have the latest version of Rubygems:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem update <span style="color: #660033;">--system</span></pre></div></div><h4>SQLite3</h4><p>SQLite3 needs some special attention to install properly.</p><p>To install SQLite3 on <em>Mac OS X 10.5 Leopard</em>:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">env</span> <span style="color: #007800;">ARCHFLAGS</span>=<span style="color: #ff0000;">&quot;-arch i386&quot;</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3-ruby <span style="color: #660033;">--</span> <span style="color: #660033;">--with-sqlite3-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span></pre></div></div><p>If you are using <em>Mac OS X 10.6 Snow Leopard</em>, install like so:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3-ruby <span style="color: #660033;">--</span> <span style="color: #660033;">--with-sqlite3-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span></pre></div></div><h4>PostgreSQL</h4><p>The PostgreSQL gem will also not install without special treatment, install it using this command:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">env</span> <span style="color: #007800;">PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>PostgreSQL8<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #007800;">$PATH</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> pg</pre></div></div><h4>Rails and all the Rest</h4><p>The other gems necessary for your development setup will happily install without any further issues:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> rails haml rspec rspec-rails cucumber capistrano capistrano-ext</pre></div></div><h3><a
name="Passenger">Phusion Passenger and Passenger PrefPane</a></h3><p>To keep your development environment one step closer to your deployment setup, you can use <a
href="http://modrails.com">Phusion Passenger</a> for development. And with the <a
href="http://www.fngtps.com/passenger-preference-pane">Passenger PrefPane</a> you even get a pretty interface for that!</p><p>Install passenger:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> passenger</pre></div></div><p>Then, install the Apache module using</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> passenger-install-apache2-module</pre></div></div><p>After the installation of the module, follow the directions and load the passenger module in your <code>/etc/apache2/httpd.conf</code>.</p><p>To make future updates a little easier you can create a config file in <code>/etc/apache2/other</code>, and it will be loaded automatically.</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">mate <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>other<span style="color: #000000; font-weight: bold;">/</span>passenger.conf</pre></div></div><p>and copy the directives from the Passenger installation into the file.</p><p>Or, if you like the command line, you can also add the file like so:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">&quot;cat &gt;/etc/apache2/other/passenger.conf &lt;&lt;EOT
LoadModule passenger_module /opt/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/ext/apache2/mod_passenger.so
PassengerRoot /opt/local/lib/ruby/gems/1.8/gems/passenger-2.2.5
PassengerRuby /opt/local/bin/ruby
EOT&quot;</span></pre></div></div><p></p><p>The command above can then be reused whenever you update the passenger gem, replacing the updated version number.</p><h4>Passenger PrefPane</h4><p>To simplify development using passenger you can download and install the <a
href="http://www.fngtps.com/passenger-preference-pane">Passenger PrefPane</a>. It will automatically add the necessary directives to the Apache configuration, so you should be able to use Passenger right away.</p><h3><a
name="SSH-Keys">SSH Keys</a></h3><p>If you&#8217;re developing and/or deploying web applications, chances are you need a pair of SSH keys for public key-based login to your servers.</p><p>Generate a pair of keys using:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span></pre></div></div><p>Install the keys into the default location and follow the instructions.</p><p>To use the key to log in to your servers, copy it to the clipboard using:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa.pub <span style="color: #000000; font-weight: bold;">|</span> pbcopy</pre></div></div><p>Then, log in to your servers and append the key to <code>~/.ssh/authorized_keys</code> for every account you want to log in with.</p><p>If you have a set of SSH keys backed up from previous installations, you can of course use these as well. Just be sure to set the correct permissions on the copied files (be sure to use your Mac OS username in the command below):</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> inz:staff ~<span style="color: #000000; font-weight: bold;">/</span>.ssh
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">600</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">644</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa.pub</pre></div></div><p>If you&#8217;ve followed the instructions you should now have a Mac fully set up for all your Rails development needs.</p><p>Let me know in the comments what worked for you what did not, so I can keep this guide up to date.</p><p>Thanks, have fun<br
/> C.</p> ]]></content:encoded> <wfw:commentRss>http://blog.blackwhale.at/2009/09/set-up-your-mac-for-rails-development/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching using disk

Served from: blog.blackwhale.at @ 2010-09-05 03:27:22 -->