<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Just a Jot]]></title>
  <link href="http://justajot.com/atom.xml" rel="self"/>
  <link href="http://justajot.com/"/>
  <updated>2012-01-13T16:04:30-06:00</updated>
  <id>http://justajot.com/</id>
  <author>
    <name><![CDATA[Justin Langhorst]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[pbcopy | pbpaste, and opening a new terminal tab in the current working directory]]></title>
    <link href="http://justajot.com/blog/2011/10/31/pbcopy-pbpaste-new-terminal-cwd/"/>
    <updated>2011-10-31T15:59:00-05:00</updated>
    <id>http://justajot.com/blog/2011/10/31/pbcopy-pbpaste-new-terminal-cwd</id>
    <content type="html"><![CDATA[<p>While I try my best to improve all areas of my life continuously (<a href="http://en.wikipedia.org/wiki/Kaizen">kaizen</a>), sometimes I fail to perform with exemplary status. Countless times a day I have the need to open a new Terminal tab in the same working directory. Before today, I issued a pwd command, copied the output using the mouse, <code>Command-T</code>, and <code>cd Command-V</code>. Ugh. That’s a convoluted mess.</p>

<p>When I was growing up and mastering conventional memory management in DOS for the sole purpose of viewing various graphical demos from around the world, I knew about and how to use every command available within the operating system. Even though that’s probably not realistic these days, it’s something definitely worth shooting for over time (hmmm <a href="http://www.linuxfromscratch.org/">Linux from Scratch</a>. If the same were true today, then I would have already been using the <a href="http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/pbcopy.1.html"><code>pbcopy</code></a> and <a href="http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/pbpaste.1.html"><code>pbpaste</code></a> utilities.</p>

<p>Now I can simply pipe the current working directory to the clipboard:</p>

<pre><code>pwd | pbcopy
</code></pre>

<p>Open a new terminal tab or window, and use a combination of cd and Command-V or pbpaste to get back to the original directory:</p>

<pre><code>cd `pbpaste`
cd [Command-V]
</code></pre>

<p>While <code>pbcopy</code> and <code>pbpaste</code> are excellent utilities, they aren’t the best solution for what I originally set out to do: open a new tab in the current working directory. I’m sure there is an even quicker way to get to the same current working directory, probably with an AppleScript, and I suspect that OS X Lion has an option for this in Terminal, but for now, <code>pbcopy</code> will do the trick.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Farewell, RVM. Nice to meet you, rbenv.]]></title>
    <link href="http://justajot.com/blog/2011/10/25/rvm-to-rbenv/"/>
    <updated>2011-10-25T15:28:00-05:00</updated>
    <id>http://justajot.com/blog/2011/10/25/rvm-to-rbenv</id>
    <content type="html"><![CDATA[<p><a href="https://rvm.beginrescueend.com/">RVM</a> is a badass tool. My only significant gripe is that it slows down the creation of new Terminal windows, something I do quite often. While there are a few other concerning behaviors (such as the overriding of key system commands like cd), it’s the slowness of opening Terminal windows that really annoys me. I’m not dependent on much of the awesome functionality that RVM provides, so it’s time to try a new tool. Meet <a href="https://github.com/sstephenson/rbenv">rbenv</a>.</p>

<p>rbenv subscribes to the Unix philosophy of doing one thing and doing it well. It’s one job is managing multiple installations (and versions) of the Ruby programming language. It does nothing else.</p>

<h3>Remove RVM</h3>

<p>Since RVM stores everything in a single place, removing it from your system completely is a simple task. In fact, the rvm implode command provides most of this functionality for you.</p>

<pre><code>$ rvm implode
$ sudo rm -rfd /etc/rvmrc
$ rm ~/.rvmrc
</code></pre>

<p>Within your <code>.bash_profile</code> (or whatever shell initialization file you typically use), there should be a line that initializes RVM:</p>

<pre><code>[[ -s $HOME/.rvm/scripts/rvm ]] &amp;&amp; source $HOME/.rvm/scripts/rvm
</code></pre>

<p>Remove it. Farewell, RVM.</p>

<h3>Install rbenv</h3>

<p>rbenv is easier to install than RVM is to remove. Usually I like to refer to the awesome Homebrew package manager for OS X, and this time is no different.</p>

<pre><code>$ brew update
$ brew install rbenv
</code></pre>

<p>Then add the following line to your <code>.bash_profile</code>:</p>

<pre><code>eval "$(rbenv init -)"
</code></pre>

<p>rbenv is now installed. Now we need to install some Rubies! Remember when I mentioned that rbenv does one thing (and does it well)? Well, that one thing is MANAGING multiple Ruby versions, not installing them. To give rbenv the capability to install Rubies, you need another tool: <a href="https://github.com/sstephenson/ruby-build">ruby-build</a>.</p>

<h3>Install ruby-build</h3>

<p>Installation of ruby-build is even simpler than rbenv:</p>

<pre><code>$ brew install ruby-build
</code></pre>

<h3>Install Rubies</h3>

<p>Now you can install Rubies all day. Why not write a script to do it? See how fast you can fill up your hard drive with Ruby installations — wouldn’t that be a beautiful thing? Well, it’d probably just be a waste of hard drive space. But in any case &#8230;</p>

<p>To see a list of available versions, either of these commands will work:</p>

<pre><code>$ rbenv install
$ ruby-build --definitions
</code></pre>

<p>Choose your favorite Ruby and install it:</p>

<pre><code>$ rbenv install 1.9.2-p290
$ rbenv rehash
</code></pre>

<p>It’s necessary to run <code>rbenv rehash</code> after installing a new Ruby version or gems that include shell commands. This simply gives rbenv the knowledge it needs to run the correct commands.</p>

<p>If you want to install multiple copies of the same Ruby version, use ruby-build instead:</p>

<pre><code>$ ruby-build 1.9.2-p290 ~/.rbenv/versions/1.9.2-p290-custom
</code></pre>

<p>Where &#8220;1.9.2-p290-custom&#8221; is the directory name where the new version will be installed.</p>

<h3>Switch between</h3>

<h4>Globally:</h4>

<pre><code>$ rbenv global 1.9.2-p290
$ rbenv global 1.9.2-p290-custom
</code></pre>

<h4>Per project:</h4>

<p>Add the version name to the <code>.rbenv-version</code> within your project’s directory:</p>

<pre><code>$ echo '1.9.2-p290-custom' &gt; .rbenv-version
</code></pre>

<p>Or override the version within the shell completely:</p>

<pre><code>$ export RBENV_VERSION='1.9.2-p290'
</code></pre>

<h4>More information</h4>

<p>For more and up-to-date information, please see the <a href="https://github.com/sstephenson/rbenv">rbenv project page</a> on GitHub.</p>

<p>Nice to meet you, rbenv. <a href="http://www.youtube.com/watch?v=cyAGZ41btx8">Boom goes the dynamite</a>.</p>
]]></content>
  </entry>
  
</feed>

