Posterous
Jared is using Posterous to post everything online. Shouldn't you?
N329600672_153908_1271_thumb
 

Jared McFarland

The musings of a 20-something old web developer.

Full Stack Ruby on Rails Development for Snow Leopard

This article is gonna talk about setting up Ruby, RubyGems, SVN, Git, Rails and MySQL for Snow Leopard.  There's a few other articles that go really in depth with setting up custom server configurations for Snow Leopard, but I found them to be doing more than I need for my personal development (here http://www.metaskills.net/2009/9/5/the-ultimate-os-x-snow-leopard-stack-for-rails-development-x86_64-macports-ruby-1-8-1-9-sql-server-more). 

In order to get started you'll have to have Snow Leopard installed, along with XCode (which includes X11).  If you don't install XCode you'll get an error trying to install things with MacPorts.

Disclaimer: This setup worked for me twice, once on a MBP and once on a 27" iMac i5.  I can't guarantee it'll work for you.  If you run into issues, feel free to leave a comment, but I can't promise I'll know the answer.

I've setup two different Snow Leopard computers in the past couple days to do this, and I've compiled some notes on what worked for me.

To start off, install MacPorts: http://www.macports.org/install.php following their instructions: http://guide.macports.org/

If you're like me, you use Bash as your default shell, so add this to your ~/.profile 

export PATH="/usr/local/bin:$PATH" 
export MANPATH="/usr/local/share/man:$MANPATH" 
export INFOPATH="/usr/local/share/info:$INFOPATH" 

Chances are, if you're using Snow Leopard, you're running 64-bit apps and you have a chip that supports 64-bit architecture.  If it does, you can force MacPorts to install apps with 64-bit architecture.  Open up 

/opt/local/etc/macports/macports.conf 

 And change the "build_arch" setting (around line 59) to x86_64.

Once that's done, you're ready to install Ruby.

sudo port install ruby

It'll take awhile, so go grab a cup of coffee or something while you wait.  Once that's done, running "which ruby" should show 

/opt/local/bin/ruby 

And running "ruby -v" should show

ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10]

Next step is rubygems, "sudo port install rb-rubygems".

After that is SVN and Git, "sudo port install subversion" and "sudo port install git-core +svn"

Next up is MySQL.  At the time of writing this, no package for Mac OS 10.6 has been released.  So download the 10.5 x86_64 package from here http://dev.mysql.com/downloads/mysql/5.1.html#macosx-dmg.  

Install both packages and the PrefPane (for some reason the pref pane is still 32-bit so it'll ask you to restart System Preferences every time you use it).

In order to access MySQL from the command line, add this to your ~/.profile

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH" 

Then run "source ~/.profile" in order to refresh your shell.

After installing Rails, you need to install the MySQL adapter gem: "sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config"

That particular command will tell it to instal the x86_64 version of the gem, and points it to your mysql config files.

Lastly, install Rails.  "sudo gem install rails".  This will install about 8 different gems, and take a few minutes.

Afterwards, you can test this all by running, "rails testapp -d mysql" then "cd testapp" then "rake db:create:all" then "./script/server" and browsing to "http://localhost:3000".  

You should see the attached screen shots.

Bonus: If you're using sqlite3, then run this command "sudo gem install sqlite3-ruby" to get it to install.

   
Click here to download:
Full_Stack_Ruby_on_Rails_Devel.zip (414 KB)

Loading mentions Retweet
Posted December 5, 2009 by Jared McFarland 
// 1 Comment

Are your friends making you fat?

This article in the New York Times is fascinating.  A review of a study concluding the effects and influence we can have on our friends and social connections.  Next time you're in a bad mood, want to light up a cigarette or you want to skip the gym, think of the effect you could be having on those around you, and more importantly, the effect on people you've never even met.

Are your friends making you fat?

Loading mentions Retweet
Filed under  //   Influence   Research   Social Networks   Sociology  
Posted September 17, 2009 by Jared McFarland 
// 0 Comments

Full stack ruby development for Mac OS X 10.6 Snow Leopard

This article goes over getting Ruby development on Snow Leopard in great detail. Worth the read if you're having trouble, or if you have a less than perfect setup on your machine currently.

 http://www.metaskills.net/2009/9/5/the-ultimate-os-x-snow-leopard-stack-for-rails-development-x86_64-macports-ruby-1-8-1-9-sql-server-more

Loading mentions Retweet
Filed under  //   Programming   Ruby   Snow Leopard  
Posted September 8, 2009 by Jared McFarland 
// 0 Comments

First SPUC update!

In order to keep myself on task with all my little programming projects (The LPP?), I joined the SPUC (Secret Project Update Club). I'll post updates once a week. This week, introductions:

  1. Codename: Stars - I started this project about three weeks ago. I got some of the basic tests and things worked out, and an idea formed in my head. I've had to revisit the organization several times... still not sure I've got it right. 
  2. Codename: A.C. Newman - This project is brand new, still just an idea. Gonna get it up and running soon I hope. 
  3. Codename: Modest Mouse - I've been sitting on this one for ages. I've go a decent idea of how it'll work, how it'll be organized and how it'll be written. Just have to get around to doing it now. 
 
Hopefully the accountability of posting here will keep me making progress on all these projects. School just started, so we'll see how that goes.

Loading mentions Retweet
Filed under  //   Development   Programming   SPUC  
Posted September 3, 2009 by Jared McFarland 
// 0 Comments

Keeping track of tickets in Git

Here at Bookmans, our development flow works in stages.  We code locally, push to a staging server, and move from the staging server to the live server.  To manage issues we have a ticket management system setup in ActiveCollab, where tickets are assigned a number by project.  A few days ago I pushed about five tickets to the staging server for review.  @tilopa checked 'em out, and told me that three of them were good to go live, but the last two had a few more quirks to work out.  This actually turned into an issue for me, I had been working in a Git branch called "jared", and merging into "master" to push to staging, then merging master with a branch called "stable" to go live.  But I didn't have a way to just push three tickets like, they were all jumbled into "master" together.

Now, when working on a new ticket, I branch out a ticket with the project name and the ticket number in it, for example "classifieds_8".  Then, when I want to push to staging, I merge that branch into "master".  When that piece of code is ready to go live, I don't merge "master" and "stable", I actually merge the branch containing the fix (ie, "classifieds_8") with "stable".  This way I can push one ticket at a time to the production server.

Loading mentions Retweet
Filed under  //   Development   Git   Tech  
Posted July 28, 2009 by Jared McFarland 
// 0 Comments

Installing ImageMagick on SnowLeopard 10.6

Update: You can install it a lot easier by following these instructions: http://github.com/masterkain/ImageMagick-sl

 

When I installed Snow Leopard on my laptop I did a clean install, so my working environment on my laptop was totally wiped out.  I had to reinstall ImageMagick the other day ( you can imagine my frustration when I was getting ImageMagick related errors thinking it was already installed properly).  The installation was a bit tricky, so I figured I'd share it with ya'll.

Here's how I did it.

  1. First, go to the MacPorts site and follow their download/install instructions for OS 10.5 Leopard.  This install went smoothly for me.
  2. Next, open up Terminal.app and type 
  3. "sudo port install ImageMagick".  This will take quite awhile, as MacPorts will download and install all of the ImageMagick dependencies.  However, when I ran the install, it didn't actually download and install ImageMagick.  
  4. To get ImageMagick installed and running, go to the ImageMagick download page and grab the Mac OS X Universal Binary.  Unzip it and you'll have a working copy of ImageMagick inside that folder (the folder will be called something like ImageMagick-6.5.3).  
  5. Now, go back to the Terminal, and move the ImageMagick folder to a permanent home (probably not good for it to sit in your Downloads folder or on your Desktop).  I moved my copy to "/usr/bin/" and renamed the folder from "ImageMagick-6.5.3" to "imagemagick" so my full path is "/usr/bin/imagemagick".
  6. Lastly, still in Terminal open up your .bash_profile or .profile file (found in your home directory; mine is "~/.bash_profile"), and add the following lines to it:

export MAGICK_HOME="/usr/bin/imagemagick"

export PATH=$MAGICK_HOME/bin:$PATH

export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib"

Note: If you moved your ImageMagick directory to a different spot in step 4, then the variable "MAGICK_HOME" will need to be assigned the proper value.

Restart Terminal and you should be set to jet with ImageMagick in Snow Leopard [=

 

Loading mentions Retweet
Filed under  //   ImageMagick   OS X   Snow Leopard   Tech  
Posted July 27, 2009 by Jared McFarland 
// 4 Comments

Rediscovering the joys of programming

I got home from the gym yesterday and decided I should start tracking my progress and performance with different lifts.  I've played around with an iPhone app (iFitness; other apps were too expensive or didn't seem so great), and found the interface too clunky and slow to actually use.  So I figured, I'm a programmer, I should be able to come up with something, right?

I decided no matter what, I don't want to use my iPhone to record reps/sets/weights at the actual gym, pen and paper work best (old skool, I know).  So really, I want a program I can transfer those stats to and chart some performance.  

I pulled out the pen and paper and started doing a bunch of diagrams... "Let's see.  User's will have workouts, will have lifts, will have sets, will have reps, will have weight.  So we've got six models to start..." etc.  In my head I was building this enormous app that I would publish, then I started thinking about servers... my personal development server isn't big enough for lots of users!  Then timelines popped in my head; I need to launch this before I go lifting again (tomorrow!!).  What about graphs and charts? Email updates? Workout suggestions?  The feature list was building at a crazy rate!

After my ten minute panic, I took a step back.  Why do I need to build this for a huge user base?  Why do I need user accounts at all? Why can't I just start with one model with some input fields?  Why do I need to impose time limits and deadlines? This is a project for me after all... I'll run it locally on my laptop and make it work for just me.  The important thing is that I start recording my data.

This revelation spawned several more: If it's just for me, I can use all the cool methods (agile, BDD, Getting Real); I can implement only the features that will make it better for me; I can start with a shitty, ugly app and build on it slowly; I can analyze my own needs, and move from there.

Then I got excited.  More excited than I've been for a project in a long time.  Like, "OMFG this is gonna ROXXORS!" excited.  I actually look forward to getting home from the office and working on this project; all because I realized it's purely mine.  

Try it with an idea for an app that you want to build just for you. Pull out anything that doesn't help your goal right now.  Work with technologies and ideas that seem exciting to you, but you don't have time to work with normally.  Get it up and running right away, so you can actually use it, and get some reward from your effort.  You'll be amazed at how quickly the energy and excitement transfers to your everyday "work" projects.

Loading mentions Retweet
Posted July 17, 2009 by Jared McFarland 
// 0 Comments

Got MySQL to work with Rails in Mac OS 10.6: Snow Leopard

After a huge headache, I found this post:

http://cho.hapgoods.com/wordpress/?p=158

And while the post didn't offer the solution I wanted, a comment by "synth" in that post did.  It boiled down to running: 

sudo env ARCHFLAGS="-Os -arch x86_64 -fno-common" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

The issue was in my choice of MySQL packages.  Snow Leopard has an entire 64-bit kernel, and so naturally, I chose the 64-bit MySQL package.  Mac OS X ships with a version of Ruby that is only 32-bit, and tries to compile with a 32-bit package.  You can force it to compile with the proper package by passing the above arguments to the installer.

Hope this helps someone!

Loading mentions Retweet
Filed under  //   MySQL   OS X   Ruby   Snow Leopard   Tech  
Posted June 15, 2009 by Jared McFarland 
// 10 Comments

You have received a YouTube video!

Loading mentions Retweet
Posted May 29, 2009 by Jared McFarland 
// 0 Comments

The difference between you and I

Over the last week, I had been followed and unfollowed by @christianrep several times.  Receiving at least one notification in my inbox every day from him, frequently more.  It was obvious that this was an annoyance strategy to get me to follow him.  I made this public announcement to him:

@ChristianRep Because you're continue to annoy me by following/unfollowing, I'm now blocking you.  Bye!

The next day I got this email from him:

===================

Jared, sorry you were offended re: the twitter follower growth tactics that I was taught to grow in two months from zero to 6843 followers.  With all of the twitter gurus that continue to promote their programs, I elected to follow Charles Yeo.  Charles started about the same time I did on Twitter.  Today, he has about 37,000 followers worldwide.  I have just not been as assertive as Charles with his system.  If you are interested in growing your follower base, I can teach you what Charles has taught me.  It’s actually very simple… yet requires about one hour per day.
 
Re: my unfollowing you so many times... had you elected to follow me one of those times that I did follow you (because you were on the front page of one of the major twitterers that I was and do follow), you wouldn’t have been unfollowed by the twitter mutual tool that I use to unfollow all those who don’t reciprocate.
 
Once again, if it interests you, please let me know.  I’ll show you what I can,
 
Brett  

===================

My response:

Brett,

I'll be perfectly clear; I have absolutely no interest in "follower growth tactics".  I have no interest in amassing as many impersonal followers as possible.  The connections I make on Twitter, like the connections I make in real life, are about being genuine.  Gaining followers by annoying them into submission doesn't create a genuine interest in what I have to say.  I'd much rather have one follower that I'm personally connected to through shared interest and ideas, than 100,000 followers that don't have any interest in what I say, or what I'm doing.  I find your "tactics" rude and intrusive, and yes, I was offended.  Even more offensive is you emailing me to name-drop and number-drop your Twitter mass.  I don't care.  I don't care how many followers you or Charles Yeo have.  I don't care how long it took you.  What I do care about is you intruding my email inbox 4 days in a row, trying to get me to follow you.  I have absolutely no interest in what you have to say, and your email proves to me that you don't "get it", and you're not genuine.


Loading mentions Retweet
Filed under  //   Twitter  
Posted May 15, 2009 by Jared McFarland 
// 11 Comments