“Getting back into the swing of things” or How Difficult It Is To Start Ruby Dev On The Mac

First I got a job, a few months out of school, working for Corporate America. Times were desperate. I was paying rent on my credit card. Then I planned my wedding for a year. Then I got settled into that whole marriage thing. These things take time. Next thing I knew, it had been about two years since I last did any coding that wasn’t for my job. My github was a ghost town. So I decided I’d pick up on something small to get started again.

 

I added a simple Atom Feed to a website…

 

But not right away.

 

First, I had to update my repo. Then I had to update my development environment. Maybe I should have done those in the opposite order. Maybe when I updated my repo, I realized nothing worked because my dev env was out of date. I decided I should document it because all the crap you might have to do is not really listed anywhere. It’s not so simple, it turns out.

 

In fact, I got to the point where I decided it was easier to “start over” by upgrading to OS X Lion.

 

So, if you develop on a Mac, and you ever want to start contributing to hackety-hack.com…

 

(Or any other rails-based website, really. I mean not all of them may use these exact tools, but well. They should. :> )

 

I recommend upgrading to Lion. I know, it’s $30. I think it’s stupid, too. But it’s worth it because the updated compilers that you get when you upgrade XCode (P.S. you have to upgrade XCode after you upgrade Lion. That part is at least free.) eleviate a lot of headaches. Also, apparently you cannot update XCode without upgrading to Lion. They’re tricky sometimes. :/

 

Also, I recommend installing homebrew. All the cool kids switched from macports to homebrew, in case you were out of the loop for two years. It’s very easy to make the switch.

 

Furthermore, you should really be using Ruby Version Manager (RVM). If you don’t have ruby installed yet, install this first. Even if you do, it will help manage what’s on your machine.

 

That said, here is the order in which I had to do this stuff in order to finally get my dev env set up…

 

$rvm update #to the newest ruby, in our case it’s 1.9.2p290

$rvm use 1.9.2 #if it is not the only Ruby installed on your system

$gem install bundler
$brew install readline #NOTE
$brew install postgresql

 

*NOTE: You may have to change the ownership of /homebrew/Cellar/readline before you are able to move forward. For some reason on my machine, its owner defaulted to root. To do that:

 

$chown -R [you] <homebrew location>/Cellar/readline

 

OH AND, you’ll need MongoDB. Which really just requires this:

 

$brew update
$brew install mongodb

 

Then you can create your git repository for hackety-hack.com. If you have absolutely no idea what I mean, github is a wonderful place that has wonderful tutorials to help you understand why git is the only version manager you should ever use. Forever.

 

THEN…

 

$cd <your hackety directory>
$bundle install
$gem install rails

 

And you can get started. You really need three terminal windows/tabs to develop. In the first one, run a rails server:

 

$rails s

 

In the second, run your database:

 

$mongod –rest #you may need to sudo mongod –rest …it depends on how you installed it

 

And in your third, you code code code!

 

$#hackasaurus

 

So in closing…

 

Please, please comment to tell me anything I may have missed and I’ll update the post. I would like this to be as accurate as possible. Let me know if I helped you! Let me know if I didn’t! I’m curious what the process is for others out there. It’s unfortunate how difficult it seems to be to start the wonderful world of Ruby Development on the Mac, but if we all work together, we can be hacking in no time.

 

Bonne chance!

Leave a Reply

Your email address will not be published. Required fields are marked *