<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>I.NFECTIO.US: Running Rails on OS X with MySQL 5.0.24</title>
    <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>"Nothing in life is worth doing if you have no life while doing it"</description>
    <item>
      <title>Running Rails on OS X with MySQL 5.0.24</title>
      <description>While installing all the pre-requisites for running Rails on my new Mac Pro, I ran across a problem with either the mysql gem or mysql 5.0.24 where it depends on 'ulong' being defined by the OS include files. On OS X it isn't, and this causes the ruby mysql gem to fail compilation which causes Rails to (possibly) throw a Lost Connection to MySQL Server during query error due to the fact that the built-in Ruby driver doesn't work with mysql 4.1+ authentication (edge rails fixes this limitation with the built-in mysql driver).

A quick fix for this is to edit the ruby gem mysql.c and add the #define for a ulong so the gem can properly compile.

&lt;pre&gt;
#define ulong unsigned long
&lt;/pre&gt;

&lt;br /&gt;&lt;br /&gt;</description>
      <pubDate>Tue, 12 Sep 2006 11:27:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:1ba473b6-32fc-4723-8fae-e1f45ebed18b</guid>
      <author>Bob Silva</author>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24</link>
      <category>Ruby on Rails</category>
      <category>rails</category>
      <category>mysql</category>
      <category>apple</category>
      <category>osx</category>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Chris</title>
      <description>Okay so I've got it all working after following the instructions from the above link.
An odd behavior is that when I now do a gem list, mysql does not show up as an installed gem...however, when in irb, I can require it and proceed as normal, no complaints.
Anyone else have this issue?</description>
      <pubDate>Fri, 16 Feb 2007 21:42:33 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:b3f3ce20-f18b-4643-9727-fdda9cae4a15</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-262</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by John bachir</title>
      <description>Thanks so much for this-- it was a real lifesaver. However I was not able to figure out which file to change and how to include that in the build until i found this article:

&lt;a href="http://jlaine.net/2006/10/3/installing-ruby-mysql-driver-on-os-x" rel="nofollow"&gt;http://jlaine.net/2006/10/3/installing-ruby-mysql-driver-on-os-x&lt;/a&gt;

Consider linking to that in the body of this post.

Thanks again!</description>
      <pubDate>Tue, 30 Jan 2007 09:05:46 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:ae4d529c-b9d0-4389-b4cf-3b72319ae937</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-256</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Aaron</title>
      <description>I figured out my own mistake.. I accidentally grabbed mysql ppc. not x86.. ha.. Anyway, I got it to correctly make, and install..

But now, the only way mysql correctly get's required when I do irbrequire 'mysql' is when i'm in the /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 directory.. 

how can I fix this issue?</description>
      <pubDate>Wed, 17 Jan 2007 16:58:22 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:a919824b-a9ac-4fb3-8e02-48a046de6f1f</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-250</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Aaron</title>
      <description>That above sucked. Anyway here was the question.. 

I've gotten mysql to make and install.. but now when I run irb require 'mysql' I get this message:

dyld: NSLinkModule() error
dyld: Symbol not found: _mysql_stmt_store_result
  Referenced from: ./mysql.bundle
  Expected in: flat namespace

any ideas?</description>
      <pubDate>Wed, 17 Jan 2007 16:27:40 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:47986095-dfa5-42e9-ac0c-b0d719567874</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-249</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Aaron</title>
      <description>I am running into another problem I don't see listed here. My mysql.c file is located here: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/mysql.c

I edit the file, adding the #define.....

First I was just running make, it was spitting out this message:

gcc -fno-common -g -O2 -pipe -fno-common  -I. -I/usr/local/lib/ruby/1.8/i686-darwin8.8.1 -I/usr/local/lib/ruby/1.8/i686-darwin8.8.1 -I. -DHAVE_MYSQL_H  -I/usr/local/mysql/include -fno-common -c mysql.c
{standard input}:unknown:FATAL:can't create output file: mysql.o
make: *** [mysql.o] Error 1

Next I did a sudo make.

gave me  this..

gcc -fno-common -g -O2 -pipe -fno-common  -I. -I/usr/local/lib/ruby/1.8/i686-darwin8.8.1 -I/usr/local/lib/ruby/1.8/i686-darwin8.8.1 -I. -DHAVE_MYSQL_H  -I/usr/local/mysql/include -fno-common -c mysql.c
cc -dynamic -bundle -undefined suppress -flat_namespace  -L"/usr/local/lib" -o mysql.bundle mysql.o  -L/usr/local/mysql/lib -lmysqlclient -lz -lm  -lpthread -ldl -lobjc  
/usr/bin/ld: warning /usr/local/mysql/lib/libmysqlclient.a archive's cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (can't load from it)
lchadrinex:/usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 aaronsh$ sudo make install
mkdir -p /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib
/usr/bin/install -c -m 0755 mysql.bundle /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib


From that message it looks like maybe I have the wrong mysql? I have an intel mac. But I was sure I grabbed the mysql intel version.. Would that be what this message is from?

Now when I fun irb  require 'mysql' 

I get this::
dyld: NSLinkModule() error
dyld: Symbol not found: _mysql_stmt_store_result
  Referenced from: ./mysql.bundle
  Expected in: flat namespace

Any Ideas?</description>
      <pubDate>Wed, 17 Jan 2007 16:25:43 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:c7f280b0-6df1-4c3b-b308-6daecdc1af0f</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-248</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Ruben</title>
      <description>The fact that ulong is not defined on OSX is not a bug in MySQL/Ruby, but a bug in mysql itself (&lt;a href="http://bugs.mysql.com/bug.php?id=22227" rel="nofollow"&gt;http://bugs.mysql.com/bug.php?id=22227&lt;/a&gt;)</description>
      <pubDate>Sun, 14 Jan 2007 12:17:22 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:007498c0-0506-4f4a-b0da-ecf8f5c40ece</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-246</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Daniel</title>
      <description>Thanks for the tips and Okada thanks for the clarification.

Just a note that I was getting the lost connection error when running rake db:schema:load from my OS X client with the target mysql database running on a rimuhosting server ... the different being the server was MySQL 4.1, not 5. 

However, the described fix worked for this setup as well.
</description>
      <pubDate>Thu, 28 Dec 2006 09:46:14 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:2b840fc7-852d-4b15-a0ce-1415c27d4aa1</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-242</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Okada</title>
      <description>I am using Mysql 5.0.27 and Rails 1.2RC1 on OSX 10.4.8. "Lost connection to MySQL server during query" was happening all the time. Installing mysql 2.7 gem following this instructions solved the problem.

For others trying to follow the instructions:

When you try to install the gem, you see the error. Go to /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 (or the equivalent on tour machine). All gem files will be there. Make the change to mysql.c and run "make", "make install" and "make clean".

Thanks, Bob.</description>
      <pubDate>Thu, 07 Dec 2006 11:13:10 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:3cbdaad1-4bf4-44d4-a671-a13dfde1e67c</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-231</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Michael Simons</title>
      <description>Cyril: Thanks a lot, that did the trick!</description>
      <pubDate>Sun, 08 Oct 2006 22:55:18 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:edb79eea-6ddc-4dd5-90f2-a1da7d0bba8e</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-181</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Cyril</title>
      <description>Hi Michael,

I used to have the same probleme as you : even mysql.c.in is re-written by the package so you can't modified it... I didn't find any way, perhaps it was obvious but anyway I modified stdlib.h in /usr/include/ and put the #define in it... it works for me.

regards</description>
      <pubDate>Sun, 08 Oct 2006 16:03:28 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:552b165b-1304-4a56-a451-624be54c5f5e</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-179</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Michael Simons</title>
      <description>Hi Bob,
i'm trying to fix my gem as well.

I use sudo gem install mysql -- blah blah include dirs

It fails and says:
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.

Where is that mysql.c that i can edit? I Just find a mysql.c.in in the above directory and editing that file doesn't work.

Any help appreciated!

Thanks from germany,

Michael.</description>
      <pubDate>Sun, 08 Oct 2006 12:15:51 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:9d237c44-c818-44d2-8353-1640fbb26ac5</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-178</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Bob Silva</title>
      <description>Spike,

Look in your site_ruby/1.8/iARCH directory for the mysql.bundle to make sure its there. If not redo the make and make install and trace from there.</description>
      <pubDate>Wed, 04 Oct 2006 21:48:16 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:0108928b-2786-49aa-9658-feb9f668d3eb</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-176</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Spike</title>
      <description>After making the edit with a successful "make" and "make install," my ruby script still complains about mysql. Instead of being an unknown constant, now it's just "no such file to load -- mysql," as if the path isn't working. (/usr/local/mysql is there.) Any simple thing I'm missing after finishing the edit?</description>
      <pubDate>Wed, 04 Oct 2006 08:37:55 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:a34cd3d3-43db-493c-9e71-66d804b32935</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-172</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Jarkko Laine</title>
      <description>Thanks, Bob, for tracking this down. Had the same problem with the same setup (MySQL OS X binary 5.0.24 + mysql gem 2.7).</description>
      <pubDate>Tue, 03 Oct 2006 03:08:04 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:557a86c9-862e-4151-9ffa-6f584894a0f9</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-168</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Peter Woolcock</title>
      <description>Hi Bob,
Sorry to leave this here but couldn't find your contact info. I need some direct support on a Pdflib project using personalization server would you be able to help? Please let me know Peter Woolcock 416-660-4931 or &lt;a href="mailto:pwoolcock@sympatico.ca" rel="nofollow"&gt;pwoolcock@sympatico.ca&lt;/a&gt;. Are you available for contract work?

Please advise 
Thanks</description>
      <pubDate>Tue, 26 Sep 2006 10:43:18 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:8bbfeb56-1eef-447a-bcb8-b9431d02d42c</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-164</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Bob Silva</title>
      <description>just run make after you edit the file</description>
      <pubDate>Sun, 24 Sep 2006 12:26:19 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:5a209fa1-0b95-4cf3-bce9-44172b8c85d4</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-154</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Hach</title>
      <description>Ok a bit of a newb question. I found mysql.c to edit and did so, but when I run:
sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql

it will overwrite the gem (presumably downloading a new copy) and thus remove the edit. 

what is the obvious thing I am missing? Thanks!</description>
      <pubDate>Sat, 23 Sep 2006 08:46:20 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:ad6e2f59-39e0-48b8-9576-7d0eb2373dc8</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-151</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Bob Silva</title>
      <description>Thanks for the warning Brad, but after working with Gabe for over a year, I'm already aware of the dangers of hiring him. Sorry Gabe, but you really were a terrible "employee". And if Brad's story is true, then my impression of you as a "person" isn't too different.</description>
      <pubDate>Mon, 18 Sep 2006 19:20:01 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:dad91295-eabf-45f4-b5b1-587625f2961e</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-143</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Brad Madiuk</title>
      <description>That's all well and good, and you obviously have no idea what happened aside from company propoganda. Nevertheless there's the warning. Take care.</description>
      <pubDate>Mon, 18 Sep 2006 11:24:43 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:b5abeed4-e019-433f-bb5b-0617e00e91ee</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-141</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Bob Silva</title>
      <description>Hi Brad,

All I can say is you reap what you sow.

Bob</description>
      <pubDate>Sun, 17 Sep 2006 11:07:25 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:61c93131-7fb3-4990-aa02-58f51cde9024</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-138</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Brad Madiuk</title>
      <description>Hey Bob, we worked together at Bnet a few years back. My apologies for posting this on your blog, however I know you're into RoR dev and so is Gabe Bauman.
My company had paid him $8,000 as a 50% deposit on some work, and he decided to high tail run off to the mountains with it and cut off all communication including cell phone, email, home phone etc. Not to mention delete the Basecamp we had worked on.

If you run into him in future, don't let a past working relationship sway you into giving him a chance. We got scammed hard.

Maybe he will see one of these posts and feel guilty and finish the work or refund us, but I doubt it.</description>
      <pubDate>Thu, 14 Sep 2006 14:16:44 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:2fa5251f-878a-4af6-85df-98bb3e05d2e3</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-136</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by atmos</title>
      <description>I was busy, it just worked so I went with it. :)</description>
      <pubDate>Tue, 12 Sep 2006 22:22:42 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:78edd53b-3e81-4b84-8999-1fd6f7b9649b</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-133</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by Bob Silva</title>
      <description>Hi atmos,

Yea, the port install may be fixed but I don't use darwin ports. I found one other guy also with .24 that had the same problem, but he didn't post any other info about it. Who uses darwin ports to install gems anyways?</description>
      <pubDate>Tue, 12 Sep 2006 21:15:31 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:0e4f4fa4-1ccc-4601-b1bb-b48b0733d9ca</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-132</link>
    </item>
    <item>
      <title>"Running Rails on OS X with MySQL 5.0.24" by atmos</title>
      <description>Hmm, I'm only on 5.0.22 but I installed the gem from darwinports without issue.  port install rb-mysql5 compiled without problems.  I might need to upgrade to 5.0.24 to see if they fix it for you or not.</description>
      <pubDate>Tue, 12 Sep 2006 13:54:34 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:a26eaa2e-2f78-459c-86fb-535bced74e04</guid>
      <link>http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24#comment-131</link>
    </item>
  </channel>
</rss>
