Blog
Masters at work...
Upgrading Gems in Snow Leopard
codeninja August 30th, 2009
As an early adopter I get to try all the cool new stuff first. Which is great, but this time it bit me. I eagerly installed Snow Leopard, the latest OSX Update, and in the process my entire dev machine broke.
The problem is that Snow Leopard runs everything in 64bit mode by default, and with all of your gems likely compiled in 32 bit mode, you will need to rebuild your gem list in order to run them optimally (or at all).
In some cases, your gems will simply fail to run, giving you notice that you should rebuild them. But in many cases you will find a serious slowdown in your gems. Webrick for example took 45 seconds to start for me.
So, After I installed Snow Leopard, here’s how I fixed this problem.
Update your gems in bulk
Issue the IRB command to open an IRB session and issue the following command to update all of your gems.
`gem list`.each_line {|line| p "Installing: #{line.split.first}"; system "env ARCHFLAGS='-arch x86_64' sudo gem install #{line.split.first}"}
If you prefer a quieter install, the command below will exclude the RDOCs
`gem list`.each_line {|line| p "Installing: #{line.split.first}"; system "env ARCHFLAGS='-arch x86_64' sudo gem install #{line.split.first} --no-ri --no-rdoc"}
Remove MySQL
Remove the 32bit MySQL Gem from your system with
sudo gem uninstall mysql
Update MySQL
First, you will need to download and install the 64bit version of MySQL, but you also need to make sure you build the native parts of the MySQL Gem as the 64bit version as well.
Download the 64bit MySQL here (64Bit Intel MySQL 5.1.37)
Then, issue the command below to update your MySQL Gem:
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
You should set the ARCHFLAGS as shown above whenever you do a gem install with native components on Snow Leopard.
Update Ports
p. If you are running macports then you will need to update that as well. Download the Snow Leopard Macports , install, and runsudo port -v selfupdate
You will need to ensure that when you install objects from ports that you set the ARCHFLAGS as we did with the gems.
All good!
With that you should (should) be back up and runing with 64 bit versions of your gems.
Filed in Blog
Recent Posts
From our Customers
I want you to know there are tears of joy coming down my face. Great Job!
[They] work hard, give you good feedback, deliver results, and have an eclectic feature set.
Dallas and his team has the upmost professionalism and eye for detail.
He is the guy who has tattooed the phrase "Nothing is Impossible" on his forehead!
Dallas and his team as Master Web Design are the best I have worked with - period.
Sorry, comments are closed for this article.