Wednesday, May 29, 2013

Ready, Set, Fling ALL THE POO !!!!

I'm going to be so unpopular for this, but here's my take on an infographic going around on Facebook (LOVE the grim reaper in the background, by the way, what a great way to manipulate the public mind):


  1. Seems to be an okay argument. If the soil is heavily contaminated with pesticides, only GMO seeds will survive the soil conditions, and farmers will be forced to switch to a new plot of land (or find a way to remove the soil contaminant). Glyphosate, an enzyme inhibitor, breaks down in the environment and has a half-life of 3 to 130 days; 75%-99.99% will be removed in just over a years time, 97%-99.99999999% (or so) in about two years.
  2. Okay argument, but see #1 re: half-life of glyphosate. (if this were entirely true, I don't think I would need to spray for weeds every year).
  3. True... _BUT_: Mono-cropping has been used in traditional agricultural for hundreds of years. That doesn't make it a good practice, it just doesn't make it exclusively true for GMO agriculture.
  4. Weak. As I understand it, Monsanto is not using this technology (currently? or are they?). However, if they did, terminator seed makes a genetic sequence inherently unfit. Nature will select against it. So the effects wouldn't last and it certainly won't wipe a species of crop off the planet (although, admittedly, this position is not specifically taken by Rawforbeaty's grim-reaper-backed info-graphic).
  5. Weak / misguided. Again this is an entirely different problem and is not unique to GMO crops.

Will I be eating GMO crops? Probably not, I'd prefer the tried and true food source with which our bodies have evolved through the years. Would I eat it if the choice were between cheap GMO food and starvation? You bet. Does cheap food lead to over-population and other problems? It seems to be the case.

Could bad things come from this? It's possible. But the same could be said for the Internet, the Television, the Radio, the Automobile, the Antibiotic, the Vaccine....

Does that mean it's an intelligent thing to do, to sling any haphazard argument that can be produced against it?





Ignorance is Strength?

Growing impatient with ignorant absolute disdain for scientific medicine, so the following rant is my coping mechanism:



Human's screw up everything through science?

In a time, long long ago (long before Monsanto came around and destroyed all the planet), some human cell screwed up while copying DNA and changed a genetic sequence. The so-affected sequence contained the blueprint for producing a rather-necessary digestive enzyme; for short, we'll call it "very long-chain acyl-CoA dehydrogenase". Lucky for the offspring, he happened to receive two copies of this blue-print (redundancy is king!), so his body was still able to make the functioning enzyme. He lived a happy, normal life, and passed the faulty recessive trait on to his offspring. After a while, the recessive trait made its rounds until it started happening that both parents contained the recessive trait. For some reason, said parent's children would die shortly after birth with a 1/4 chance. Clueless as to what caused the death, 3/4 children would turn out fine and continue to propagate the gene.

Fast-forward to the near present. Meet my nephew: born into this world to WONDERFUL parents that both happen to carry the recessive genetic trait. My nephew is awesome! I love this little guy. He got two copies of the recessive trait and has a genetic disease known as VLCAD.

Thanks to advances in scientific medicine, medical screening promptly detected the disease and medical intervention saved his life. Thanks to understanding of the condition, he will live a healthy life! This is so awesome, because, like I said, my little nephew is a REALLY COOL KID. Thanks to advances in scientific medicine, we can all be screened for this recessive trait and know the chances of our children being born with a genetic disease. This is REALLY COOL!

If you think nature is so good at everything, and that we should stop medling with nature, let me introduce you to an idea: NATURE KILLS BABIES [1]. Nature applies natural selection MERCILESSLY AND WITHOUT FEELING. Nature is the means through which future generations are blessed by the fact that the "unfit for survival" did not survive.

Application of science is not perfect? Sometimes it goes awry and people die? Application of science does harm, from time to time? Profit motives cause people to make compromises that are less than optimal? Sure, it happens occasionally. Can it be better? Yes. Nature still kills babies, and medical science is getting in its way more than ever before.

My plea is that we set down our weapons of sweeping generalizations, putting forth any argument not because they are sound but because they support a position we've adopted by studying the facts presented by one heavily biased view.

Since somebody's believer is another's cynic, it seems like a good idea to tread with skepticism any time you see a perfectly constructed, dichotic exaltation/demonization of the sides of a given issue; at least until you have tried to argue the pros and cons of both sides.

[1] Certain situations only. (that's called honesty!)

Saturday, October 27, 2012

Spaced Repetition Learning Systems: Achieving Flow in Rote Memorization

My 5-year-old daughter and I have been working on her flash cards using the old physical decks for some time. Not having much of a system other than just cycling through the same old deck started to feel wasteful: I didn't have a good way to prioritize the cards with which she'd particularly struggled, so we spent the largest majority of the time going through words she knew really well. Even more, it seemed to discourage her from learning new words as hard words were shown too infrequently between a long stream of easies that the fluctuation between boredom and frustration stressed her out.

For some time friends of mine have recommended to me the Anki flash card system; Anki is an implementation of the Spaced Repetition Learning System: a system of learning based on common-sense principles such as showing at greater frequency cards with which the learner struggles, and less frequently those that have been mastered.

Using this system, it seems that my daughter gets a well-balanced mix of words she's already mastered, words she's learning, and brand new words, and in the end that seems to help keep her in the optimal state of flow while learning [1]! This is corroborated by her being excited to do the flash cards each evening.

After using this system 15 minutes a day, in just ONE WEEK my daughter has mastered all 100 of the sight words her teacher had assigned! I am so proud of her!

If you'd like to learn more about the Anki system:





It runs on all the OS's and devices, including iOS, Mac OS, Android, and the web. (the developer seems to fund his efforts through iOS sales, as that is the only platform for which he charges, and notably, a charge I was happy to pay.)

  • [1] - Flow is the"... mental state of operation in which a person performing an activity is fully immersed in a feeling of energized focus, full involvement, and enjoyment in the process of the activity" [Wikipedia]. One of the requirements to reach "flow" is an optimal balance between challenge and ability.

Saturday, May 26, 2012

Danger: Dragons

Promote safety with this effective warning tool:


Dragon silhouette lifted from Kary (who in turn lifted it from Here).



Thursday, May 24, 2012

Celiac disease

As some of you may have heard, this week I was diagnosed with celiac disease. I was shocked, as I went in to be tested for something else. There is a small chance that the diagnosis could be wrong, so further blood tests at being run to confirm the diagnosis.

Celiac disease is a genetic disease, but some people who have the gene sequence do not develop symptoms. "According to the University of Chicago Celiac Disease Center, if you are a first-degree relative (parent, child, brother or sister) of a person with celiac disease, you have a 1 in 22 chance of developing the disease in your lifetime. If you are a second-degree relative (aunt, uncle, niece, nephew, grandparent, grandchild or half-sibling), your risk is 1 in 39". (link). So odds are, if you're related to me: you're probably safe, but watch out for it. It manifests in a lot of different ways, and is very hard to diagnose by dietary experiments.

Gluten is in EVERYTHING, and figuring out whether or not it contains gluten is very complex, since it is often not specifically labeled as other common allergens are. Brown rice syrup, lunch meats, dressings, soy sauce, imitation bacon, and many other innocent sounding foods SOMETIMES DO contain gluten (link). It doesn't matter if I consume a little bit of gluten, or a lot of gluten: a small amount is all it takes to trigger auto-immune response, which in turns causes the damage. I went off of grains for 4 weeks during my low glycemic diet, but likely still consumed other products containing gluten during that time; this may be why I and other doctors missed the association.

To my friends and family reading this: I fear my diet, now even more restrictive than ever, will be more of a burden for others than it is for myself. I want to be clear: I have absolutely zero expectation that anyone prepare any special food for me at any family function, gathering, or party. It's stressful to others, and it's stressful to me. I'll plan on bringing my own food, or waiting until I get home to eat. So please, if you say, "I'm sorry I forgot to plan something for you, Tim", know that I will be mad (only for a brief second) for not honoring my wishes to not worry about me or feel any induced stress from my dietery needs. I'm very serious about this.

(I will be grateful if you do remember, and do plan something. I just don't expect it. I will need to dissect the ingredient list, and please don't be disappointed if I find a possible of source of gluten.)

Thank you.

Further reading on Wikipedia



Update: Blood test results confirmed the diagnosis.

Monday, March 26, 2012

Asthma

Over the last few years, I’ve developed a few onsets of asthma: I’ve had a few successful remissions, and a few regressions of the disease. This post will serve as a log to best describe my experience with asthma, what I’ve done successfully send it in remission in the past, what I belive I brought it on for me, and what I am currently doing to try and send it into remission again.

Hypothesis for how I developed asthma

My current hypothesis for what I did to develop adult onset asthma has been a combination of the following:

  • Poor, POOR diet. (At one job, about 1 year before I developed had my first onset of asthma, I ate pretzels for lunch most days during a week… horrible, HORRIBLE idea). Lots of refined sugar and flour. Hardly any fruits or vegetables. Lots of ice cream, milk, etc. (completely the opposite of how I eat now)
  • High stress
  • Irregular sleep / continual sleep deficit

I theorize that the above weakened my immune system to the point that a chronic infection (such as Chlamydia Pneumonia or Micoplasma) was able to settle in my lungs.

A brief log

2002-2004 – While living in Argentina, I get sick a lot. Sinus infections, Bronchitis and Pneumonia seemed to be my constant companions. This may have been when I picked up the alleged bug, if it’s what I have. It’s possible for it to hide out in your body, relatively asymptomatic.

2007-12 – Asthma onsets. For several months, I use a Primatine mist inhaler (now off the market, thanks Al Gore) to keep lungs open, but after a while the inflammation becomes so great that it doesn’t matter if I use the inhaler, lungs are open but not much air getting to the bloodstream. I see a naturopath who prescribes a better diet, some supplements, and to eat more yogurt. I try it, with no success. I see Dr. Hugo Rodier, who puts me on a special low-glycemic diet, with supplements (Probiotics, silver shield, Constant Health drink, slippery elm, herbal anti-parasite, vitamin D, Omega 3), and in a few days the asthma goes away. When I introduce milk back into my diet, asthma returns, so I conclude that I’m now allergic to milk. I’m free from asthma for a year+, breathing well, although I constantly clear my throat and cough (lots of people notice).

(Sometimes I was able to get away with a little bit of milk without a flare-up, so it’s obvious to me, in hind site, that milk was not the only problem. I was able to eat can’t-belive-it’s-not-butter for a while)

2009-04 – Asthma returns. My diet had “fallen off the bandwagon” since I figured my asthma was caused by milk, so therefore I could eat as much candy and sugar as I desired, so long as I avoided milk and ate the occasional fruit or vegetable. Rodier puts me back on the diet: Low glycemic, silver shield, Paracleanse (herbal anti-parasite), Constant Health, vitamin D, Omega 3, probiotics. Asthma goes away within 2 days. I finish the diet, and continue asthma free.

2011-07 – Asthma begins to return. I have attacks that I am unable to associate directly from milk consumption, but assume that I must have consumed some accidentally (Whey is in bread, sauces, etc.). I can overcome the attacks with a simple anti-histamine (Benadryl).

2011-09 – I see an allergist. It’s confirmed that I’m allergic to grass, pet dander, milk, mold, fungus, EVERYTHING. He also does a lung test and concludes that I have asthma. I tell him I feel fine enough. He gives me a bunch of free sample drugs, among which is a steroidal inhaler, Ciclesonide. I take it. I breath better. But I’m hesitant to continue taking it because of the side-effects. I’m told I need it, otherwise I will have an attack and a rescue inhaler won’t work for me. Also, going on with asthma untreated will scar my lungs and permanently damage them. Reluctantly, I continue using the inhaler.

2011-11 – I go off the inhaler for a while and am fine for a week. Then the asthma came back. I refill the inhaler. I cut sugar from my diet, and wheat. Neither seemed to help. I see a conventional doctor, he gives me a steroid burst pill pack, asthma goes away for a week. I seem to be doing fine.

2011-12 – Asthma spirals downward. I suspect acid reflux problems, doctor starts me on Prilosec. I can’t sleep, every time I lay down, I can’t breathe. I get a space heater, air humidifier and a better vacuum. It seems to help. I do Dr. Rodier’s diet again, this time without Paracleanse or Silver shield, but with the addition of SAM-e and a MSM sulfur supplement. I stop the Prilosec and do a compounded anti-biotic (can’t remember which one) and anti-fungal burst, coupled with probiotics. After a week, I seem to notice a small improvement, then I return to original asthma state. Acid reflux symptoms appear to be mostly gone / no longer noticeable.

(I also change my eating patterns to not eat 1-2 hours before bed).

2012-01 I start immunotherapy (allergy shots), I go 3 times a week. My asthma does not get worse or better with injections, leading me to believe that the asthma is not entirely caused by allergies. My asthma doesn’t respond to antihistamines any longer, I feel the same either way.

2012-02 I see Dr. Rodier again, and we hit it again with Gentamicin and anti-fungal (still taking probiotics). Same story: a little improvement after a week, then return. My diet consists primarily of hand-prepared Salads and smoothies (usually organic ingredients, sometimes not), with the occasional deviation when eating out. Any item with sugar in the first 3 ingredients (or higher that 20% sugars) is avoided.

2012-03 I stumble upon the research of Dr. David Hahn, Jim Quinlan’s story (http://www.asthmastory.com/) and Dave Oshinsky’s story (http://oshinsky.org/asthma.htm). I tell Dr. Hugo Rodier about it, present Dr. David Hahn’s recommended treatment protocol, to which Dr. Hugo Rodier says, “from my research, he seems to be barking up the right tree”. He prescribes it to me, along with another anti-fungal (fungal infections are a risk when taking antibiotics, he says), Vancomycin.

2012-03-15 I fly to California for a conference. There, I start the treatment protocol, kicking off with three daily 750mg Zithromax tablets to burst, then one 750mg tablet per week. I had horrible asthma essentially the whole trip. (Especially our hotel room, I felt as if the building were trying to kill me.)

2012-03-16 On the second night of my trip, at about 4:30 AM, being unable to sleep for 7 hours, I was about ready to change my flight and take the first plane out of there, missing the rest of the tech conference I flew down there to attend. Just as I about clicked the button to confirm my change, it occurred to me that I may be having problems with the bedding. Sure enough, comforter / pillows were all stuffed with feathers, and that was driving my lungs crazy. Switched to hypoallergenic and did OK the rest of the trip, but not great.

2012-03-21 I have a dull, faint ear ache that comes and goes during the day. Using the nasaline seems to make it feel better. Nasaline also seems to help reduce inflammation in my lungs.

2012-03-24 I have an asthma attack all night long that nearly sends me to the E.R. room. I have been taking Ciclesonide twice a day. I hit the albuterol, not much improvement. I took an oral prednisone. Not sure how long it takes to kick in. I notice that I have anxiety, so I also take SAM-e (side note: I’m persuaded that SAM-e works, have noticed a correlation between improved ambition, excitement for life, and general happiness the day after I take a SAM-e, and this persuasion came after skepticism and disbelief that it did anything at all, so I took it on and off until I started to notice a trend). After two hours, anxiety subsides, lungs function well enough that I don’t feel like I’m suffocating. I sleep

All this while I’ve been able to climb at the gym. I have less asthma, it seems, when I engage in strenuous physical activity.

2012-03-25 I take two oral steroids during the day, ciclesonide twice, and one rescue inhaler hit. I feel pretty crappy, but make it through the day. A few times during the day I felt good, then bad, it goes in cycles. At one point it was uncomfortable to read out loud because I was short of breath. During the night I take the dog for a short half-mile run (haven’t jogged in a while). I come back, lungs hurt, I cough up a bunch of stuff, I feel like I can breath well.

2012-03-28 The ciclesonide is no longer working. I feel horrible whether I take it or not. It’s clear to me that my condition is worsening. Earlier it was suggested to me to switch to Advair (or something with a long-acting beta-antagonist). I execute the suggestion and Advair works! I can breathe amazing. I love it, but don’t love the side-effects that Advair brings with it (increase risk of death, eye cataracts, etc.)

2012-04-16 I see my asthma doc, and a pulmonologist. I tell them of worsening symptoms. Spirometry test shows 81% FEV1 ratio, again. Asthma doc suggests I start Singulair, gives me a sample. I see the pulmonologist. He congratulates my dietary efforts, says he has heard of Dr. Hahn’s treatment and has tried it 3 times, 1 time having success. Encouraged me to continue it. Said he thinks I just need more coticosteroids based on the wheezing he is hearing, and in his opinion, he doesn’t think that I’ll be able to get this under control with diet (although he admitted that he could be wrong). In the short term, I believe he’s right, in the long term, I hope he’s wrong. Singulair seems to help right away, but not much.

2012-04-18 Singulair does seem to help, but don’t really notice a huge difference. Still not breathing well: Every moment alive is a moment struggling for breath. Feeling LOTS of neck pain. Feeling VERY depressed, and consider that if I do continue this way, I would prefer my life to end sooner than later (although this is followed by renewed determination to overcome this as I think of the pain my family would feel should I depart, and even though it doesn’t seem like it now, it’s possible that I will fully overcome this). I read about Singulair being associated with increased risk of suicide and wonder if it’s affecting me that way, but I think it’s more the desperation of feeling so sick, continually getting worse, and not knowing why.

2012-04-20 Asthma continues to worsen. After I inhale Advair, I feel even more wheezy, and am no longer getting the same effect. When I started Advair, I felt great, but now on Advair, I feel so short of breath that I can’t comfortably talk. I feel I should look up the ingredients in Advair, and discover that Advair has milk in it. In the prior year, I was tested positve for milk allergies. I tell my allergy doctor and he quickly switched my prescription to Dulera. The night after taking Dulera, I feel amazing again.

2012-04-21 I have an asthma attack after sitting in a musty cheap movie theatre for about 50 minutes. I sense it coming on, and have to leave the movie early because it gets so bad that I feel I’m about to lose consciousness. Take rescue inhaler, two puffs 5 minutes apart, doesn’t work. I barely feel good enough to drive home. I sleep poorly.

2012-04-22 I travel to Europe for business. At the beginning of the trip, on the plane and in London for the first few days, I’m certain I made one of the biggest mistakes of my life, and consider flying home early to go to the hospital. I use my rescue inhaler every couple of days. I breathe OK if I’m outside, but the second I step into a building (new building old building, any building), I start to feel breathing difficulties.

2012-04-22 I travel to Europe for business. At the beginning of the trip, on the plane and in London for the first few days, I’m certain I made one of the biggest mistakes of my life, and consider flying home early to go to the hospital. I use my rescue inhaler every couple of days. I breathe OK if I’m outside, but the second I step into a building (new building old building, any building), I start to feel breathing difficulties.

2012-04-28 Something changes. I feel amazing. I’m still taking Dulera and Singulair, but I feel like I don’t have Asthma symptoms any more. It’s incredible.

2012-04-03 I return home. By the night time I notice I’m starting to feel worse again.

2012-05-04 I see my allergy doc. Starting to feel worse again since returning home from Europe. Peak flow is at a consistent 81% FEV1 ratio (has been all along, since Sept 2009). Doc comments on how spooky it is that I’m that consistent. Together we decide to see if I respond to prednasone and my FEV1 ratio increases. I begin immediately a schedule of 40/40/40/40/30/20/10mg

2012-05-08 I have one of the worst attacks I’ve experienced in a while. It felt weird: I was breathing really shallow. I felt sweaty one moment, then not, then again. I went down and used my rescue inhaler, it didn’t seem to yield any immediate results, but maybe it at least had a calming psychological effect on me knowing that I would be ok? Took a hot shower. Still not breathing well, felt resistance breathing in as well as breathing out (that’s a new sensation for me, or at least the first time I’ve experienced it). I wake up Laura and tell her I may need to go to the hospital. The strangest thing is I was blowing really well on the peak flow meter all while feeling short of breath: I felt like a 520, but was blowing easily a 620. Typically 620 is what I blow when I am feeling really good. For a moment I think maybe the bronchodilator (rescue inhalor) had its effect on opening my lungs and how I was feeling was lagging slightly behind? I feel really discouraged that I’m having asthma attacks while on Prednasone, one of the strongest asthma medications known (and a very harmful one to be on long-term).

2012-05-09 I see Dr. Coy again (Primary care physician, not asthma doc). He comments on how strange it is that I have difficulties breathing on Prednasone. He hears wheezing. My mom mentions earlier that I may have anxiety. I feel confident that anxiety is definitely not the source of the problem, but am willing to admit that perhaps being on anxiety medication will help a little. Dr. Coy agrees that I am showing symptoms that are definitely not anxiety, but that it’s worth a shot to see if it helps me breath a little better. Dr. Coy suggests I may have GERD again (we experimented with this earlier with the Prilosec). Growing tired of this approach and growing impatient, “I don’t care how expensive it is! I want to know what’s going on in my body, and run whatever tests we can! How can we eliminate the possibility of COPD?” He suggests a CT scan. I go get one, it comes back normal (what a relief! But also… still don’t know what’s wrong with me).

2012-05-10 I schedule an appointment with a GI doc to confirm / rule out GERD. The theory is acid reflux may be causing acid to enter my trachea, causing inflammation and wheezing in my lungs. I’m feeling more heartburn recently and have to take antacids frequently (For the past several weeks I carry them with me). Doc says, “try Prilosec for a bit”. I tell him no, I want to know what’s wrong, I want an endoscopy done, I don’t care about the cost. We schedule an appointment for the following Thursday (a whole week of waiting). I see an ENT specialist, he’s little help (probably rightfully so): “Tough problem you have there, that’s out of my area, good luck with that.”

2012-05-11 I am VERY cautious about over eating, eating 4 hours within bed, and snacking all day long. I focus on giving my digestive system breaks. Consequently, my wheezing goes down significantly. I no longer feel it to be difficult to breath. I still have some shortness of breath at times.

2012-05-17 Endoscopy does not find evidence of GERD as I suspect, however, while looking around they discovered evidence of Celiac disease. Further biopsy and blood test both confirm.

2012-05-19 I begin a gluten free diet. I’m feel as if I’m getting better, but still take Dulera at the same dosage (no long on Singulair). At times I feel “air hunger”, even though my lungs are well open. Taking anxiety medication helps quickly (Alprazolam).

2012-05-25 I’ve continued with the antibiotic treatment faithfully. My asthma is doing much better, but the problem seems to be very complex and it is difficult to attribute which things I’ve attempted have been fruitful. When I was on the Prednasone, I felt worse than I ever had before, but by simply eating smaller dinners, being careful not to overeat, elavate my head during rest, I felt a large, immediate, measurable improvement in wheezing. Then the anxiety medications seemed to solve the air hunger. Late last year, when I originally suspected GERD for the first time, I tried to pay close attention to not eat so close before bed, and it didn’t seem to yield the same effects of relief as it has recently, but then again, my asthma wasn’t as bad back then as it was in April. Certainly I might suspect the celiac disease to be the major player, but I DID go wheat-free for several weeks (although it’s possible I was getting gluten from an unknown source, a supplement, a sauce, a salad dressing, who knows). Celiac disease is associated with impaired immunity (even pneumonia), so a CPN or Mycoplasma infection doesn’t seem totally far-fetched. My asthma did start to let-up in late April, about 7-8 weeks in to the treatment. I’ve decided that I’ll continue the antibiotic treatment (2 more weeks remaining), and of course, the strict gluten-free, milk-free diet with an emphasis on whole, unrefined, unprocessed foods.


I plan to continue updating this post as I progress in my recovery.


Conclusion / Summary

I am told that the antibiotic therapy will not show any results for at least 4-6 weeks, and maybe not even for 12 weeks. As of 2012-05-27, it’s been 10 weeks, and I do feel that symptoms are definitely improving, but it’s complex and truly difficult to know what to attribute what to. In retrospect, it seemed like my asthma spiraled out of control after I began using the Ciclesonide. I suspected that Ciclesonide impaired my immune system such that the ongoing, perpetual battle between the alleged microbe and my immune system was made very unfair for my immune system, and the microbe took deeper root. However, now I doubt that to be the case. Here’s what I know:

  • My asthma became signifacantly worse since starting Coticosteroids.
  • My asthma has improved since starting the antibiotic treatment, at about 7-8 weeks, right about as expected.
  • My asthma improved since switching from Advair to Dulera, although it did seem to get much worse for a few days.
  • My asthma seems to have improved since focusing on eating less at night, 3-4 hours before sleeping, elevating head at night, taking antacids, although it didn’t seem to respond quite that way 4 months earlier when I’d tried to pay attention to that.
  • My breathing problems also seem to be caused by anxiety.
  • I have Celiac Disease.
  • I make a lot of theories.

None of the information linked here is intended to be medical advice. Zithromax is not a side-effect free drug. If you need asthma medications, and you go off of them prematurely, it could put you at risk. Consult with your own physician / allergist before taking any drugs.

I want to publically thank Dave Oshinsky for corresponding with me in a very helpful and responsible way.

Links / Further research

Tuesday, November 30, 2010

Building MySQL multiarch (32/64 bit) client libraries on OS X

Getting the mysql gem to build can be a pain. Especially if you have installed the 64-bit version of mysql and are using a 32-bit version of ruby

You can check the build arch of an executable/library via the file command, such as:

$ file `which ruby`
/Users/timcharper/Developer/.rvm/rubies/ruby-1.8.6-p383/bin/ruby: Mach-O executable i386
$ file /usr/local/mysql/lib/libmysqlclient.dylib 
/usr/local/mysql/lib/libmysqlclient.dylib: Mach-O 64-bit dynamically linked shared library x86_64

See how those disagree? If you're using homebrew (which you should be!), you can build the client libs/tools only (universal style) as follows:

brew install mysql --client-only --universal

Then, to install the gem, you need to pass some fancy flags to get the mysql gem to link against your new libraries:

HOMEBREW_PREFIX=/usr/local # if your prefix differs, modify this line

gem install mysql -- --with-opt-include=$HOMEBREW_PREFIX/include/mysql/ --with-opt-lib=$HOMEBREW_PREFIX/lib/mysql --without-mysql-config

Your gem should build with no errors, and your new shiny universal mysql client libraries should serve you well in the future if you use both 32-bit and 64-bit rubies.