Setting up Ruby on Rails, MySQL, Mongrel, memcached, and RMagick using MacPorts on Mac OS X 10.5 Leopard 5
I recently got the new Santa Rosa Macbook with Leopard pre-installed and I need to set up the Rails development environment.
Basically there are 3 ways to achieve that:
1. Locomotive
Locomotive method is simple and self contained. It works very well for Mac OS X 10.4 Tiger. However, the author acknowledges that Locomotive may not be Leopard ready.
2. Rails comes with Leopard
That’s right. Apple has included Rails by default, as noted by DHH. This sounds great. However, that means you will also have to manually install Imagick, RMagick, and all those other stuff that you need for development. Also, it may be harder to upgrade Ruby or Rails when new versions come out. You probably need to install from source to upgrade or what not…
3. MacPorts
You might already have your Rails environment set up using MacPorts. If that’s the case, why not just use that? Even if you are like me with a fresh installed Leopard, MacPorts still has its advantages. For example, you can use MacPorts to upgrade ruby in the future.
I used MacPorts to set up my Rails environment based on these other great articles:
1. Install the latest Xcode version for Leopard. Download from the Apple website.
2. Install the latest MacPorts version for Leopard. Download from the MacPorts website.
Run this to update MacPorts:
sudo port selfupdate3. Install Ruby, RubyGems, and Rails.
sudo port install ruby
sudo port install rb-rubygems
sudo gem update --system
sudo gem install rails -y4. Install MySQL (directly from Andrew Nesbitt, shown here for completeness).
sudo port install mysql5 +server
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
sudo -u mysql mysql_install_db5
cd /opt/local ; sudo /opt/local/lib/mysql5/bin/mysqld_safe &
sudo ln -s /opt/local/var/run/mysql5/mysqld.sock /tmp/mysql.sock5. Install mongrel and mongrel_cluster.
sudo gem install mongrel
sudo gem install mongrel_cluster6. Install memcached.
sudo port install memcached
sudo gem install memcache-clientCreate a file called /Library/LaunchDaemons/com.danga.memcached.plist, and insert the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.danga.memcached</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/opt/local/bin/memcached</string>
<string>-d</string>
<string>-m</string>
<string>64</string>
<string>-u</string>
<string>www</string>
<string>-p</string>
<string>11211</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>In order to launch memcached on boot, enter this in the terminal:
sudo launchctl load -w /Library/LaunchDaemons/com.danga.memcached.plist7. Install ImageMagick and RMagick
sudo port install ImageMagick
sudo gem install rmagickNEW! There are now instructions on how to install ImageMagick and RMagick.
8. Optional – I found out if you have the loaded_plugins gem installed, you may see the following error when running script/console:
/opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:477:in `const_missing':NameError: uninitialized constant Gem::Version::NUM_REThe reason is MacPorts create two directories to store the RubyGems stuff in /opt/local/lib/ruby/site_ruby and /opt/local/lib/ruby/vendor_ruby. Ruby’s $LOAD_PATH looks in site_ruby first but the version.rb in site_ruby does not define Gem::Version::NUM_RE whereas the version.rb in vendor_ruby does. I’ve outlined the issue here. So I simply swap them:
sudo mv /opt/local/lib/ruby/site_ruby /opt/local/lib/ruby/vendor_ruby_tmp
sudo mv /opt/local/lib/ruby/vendor_ruby /opt/local/lib/ruby/site_ruby
sudo mv /opt/local/lib/ruby/vendor_ruby_tmp /opt/local/lib/ruby/vendor_rubyThis fixes the error and everything runs well for me, but I would like to hear the experts out there about why there are separate vendor_ruby and site_ruby.
That’s it. Hope you find this helpful and please report any problems.
Trouble with Airport Extreme
I picked up the AirPort Extreme Base Station with Gigabit Ethernet and the wireless Mighty Mouse from the Apple stores with their “just ok” Black Friday sales.
I have experienced a lot of connection drops with the Airport extreme. The thing keeps dropping the wireless connections at random frequent intervals, rendering it useless. I had to reset and reconfigured it for it to pick up again. Also, the Airport Utility cannot always find the base station. When that happens, time for a reset.
I was hoping to replace the DI-524, but I guess that has to wait a little longer until Apple has either a firmware or hardware fix. This piece of junk is going back to Apple. Disappointed.
On another hand, the mouse works pretty well with the Macbook.
My new Macbook so far
I ordered a white Santa Rosa white Macbook (comes with Leopard at 2.2GHz) from Amazon with $75 rebate and it took them a week to begin shipping on 11/19, but it arrived on 11/21, just in time for me to explore it over the Thanksgiving break.
Here’s what I think: So far so good. This is my first Mac, as well as my first Apple product :) I am happy that Amazon puts the Macbook in another brown box so that my Macbook box does not look trashy when it arrived. So kudos to Amazon. They are really a great place to shop at, as well as Newegg.
The box opening experience was cool but not spectacular. I have taken some pictures during the process. When I took the Macbook out, I got excited and was mad at myself putting my own fingerprints on it…LOL
Turned it on, saw the Apple logo, arrived at the Select Language screen. That’s it. I was not going to take anymore pictures to ruin my experience.
During the initial setup process, I heard the fan came on very loud several times and I was like: Shit, is my Macbook going to be this loud when I do anything. Fortunately, that goes away once the setup process is over with.
The display is beautiful and I had no problems with the glossy screen. When the display is turned off, it is glossy that you can see a reflection of yourself, but once you turn it on, it feels just like a regular LCD display, only brighter and sharper.
I am learning a lot of keyboard shortcuts and installed some applications, but there’s just a lot more stuff to explore with. So far so good.
OnMyList now has a new makeover
We’ve changed the look of the site and added a LOT of new and exciting features that we hope you will find useful and improve your listing experiences. You can read about the new features.
List you pants off at OnMyList.
OnMyList allows you to crop your profile pic now (or very soon)
It took us some time to figure out this crap attachment_fu and s3 woes.
Do you have a career?
Career, in Wikipedia terms, is defined as:
Career is a term defined by the Oxford English Dictionary as an individual’s “course or progress through life (or a distinct portion of life)”. It usually is considered to pertain to remunerative work (and sometimes also formal education).
A career is traditionally seen as a course of successive situations that make up a person’s worklife. One can have a sporting career or a musical career without being a professional athlete or musician, but most frequently “career” in the 20th century referenced the series of jobs or positions by which one earned one’s money. It tended to look only at the past.
In simpler terms, a career is a series of jobs that a person takes on throughout his working life. Nowadays, it is rarely that a persons works for one company for his life. You are likely to change jobs. Some do it frequently in hope to raise their pay. Some do it because they are bored after a few years at a job and want to be in a different environment. No matter what your reasons are, changing jobs seem to happen to everyone in the world at least a few times.
However, there is no guarantee that we will be happier in a new job until we actually changes to that new job. If John changes jobs 6 times during his working life, do you think he will end up in a better-than-before situation all 6 times? A lot of people do not seem to realize that they are wasting their time and effort if they only evaluate job offers by comparing salary, paid time off, health insurance coverage, ...etc. Others say they like the work environment too. While they are comparable, they do not offer the person much in terms of advancing his career.
- What if your initial salary and signing bonus are great, but the company then cuts corner by giving you meaningless annual raises and pitiful bonuses afterward.
- Even if you have 30 days of paid time off, do you think you will be less busy before and after you take that long vacation? The work is still there for you to do, whether you take vacation or not.
- What if you stay relatively healthy, you then waste your health insurance money. If you have a serious health problem, you will spend most time taking care of your body instead of getting paid fully to do any work.
- What if there is a shakeup in the company or your department, or people come and go? Does the work environment always stay the same?
Instead of focusing on these qualities, I think a person should evaluate a job by trying to fit it into his perceived career choices.
There are many choices we make in life, some good and some bad, but there is always something we can learn from them. There are many jobs we take in life, some good and some bad, but there is always something we can add to our career.
Telling people to love their jobs is utterly irresponsible. I don’t think anyone should love his job because he is supposed to, or because he is getting paid to do his job. This person also provides his services to the company too. It is really a contract between two entities that they agree on. Do you think the company still love you when they lay you off?
Instead of loving your job, I suggest you frequently evaluate your job by trying to fit it to your career. Does the job help build your career? Does the job add any skills to the career you dream about? You cannot love you job unless the job is part of your career that you are willing to spend part of your working life to add values and skills to your career.
Only when you can ascertain your jobs can add to your career can you claim to have a real career.
(With that being said, if you are contemplating a career change, you most likely should change jobs as well, because you will need a job that can add to your new career.)
OpenSocial API in action
OpenSocial API in action within Ning networks: Open Social: screencast and screenshots


