Installing the MySQL Ruby Gem on OS X 10.6 (Snow Leopard)

This entry was posted September 18 2009 under Uncategorized.

11 comments

UPDATE: The advice in this post may work for some people, but I didn’t have complete luck until I installed MySQL via MacPorts, and then completely reinstalled Ruby and RubyGems via the Instructions at Hivelogic. Feel free to post a comment if you’re still having trouble.

Holy jumping crap am I ever sick of installing the MySQL gem. If I never have to do it again, it will be too soon. That being said, here’s what you get (as usual) if you

sudo gem install mysql

on Snow Leopard:


Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
	ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/usr/local/bin/ruby
	--with-mysql-config

Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.

This time it’s pretty simple. First of all, get rid of any old versions you have kicking around

sudo gem uninstall mysql

Next, install the newest MySQL package. Make sure you get the 64-bit version. For me it was 5.1.38. After that, and here’s the important, install Xcode from your Snow Leopard disc. Don’t skip this step! You may also need to update your RubyGems install:

sudo gem update --system

Finally, you just need to install the gem telling it where your config file is:

sudo gem install mysql -- --with-mysql-config=/usr/local/mysql-5.1.38-osx10.5-x86_64/bin/mysql_config

And that ought to do it!

Installing the MySQL Gem on Slicehost (Ubuntu)

This entry was posted September 13 2009 under Uncategorized.

No comments

Seems like getting the Rails MySQL gem installed on various systems would make a good candidate for a series of blog posts. Hopefully this will help somebody out. Trying to install the gem on Slicehost will product the dreaded “Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers” error. Thankfully this is easily fixed:

sudo gem install mysql-server
sudo gem install libmysqlclient15-dev
sudo gem install mysql

Shazam!

Installing the MySQL Gem on Red Hat Enterprise Linux

This entry was posted August 7 2009 under Uncategorized.

No comments

There is nothing quite so much fun as installing the MySQL gem for Ruby. It seems like every time I try to do it I wind up with a different issue. Today’s issue was simple yet easy. When running gem install mysql I was greeted by this lovely message:


ERROR:  Error installing mysql:
	ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb --with-mysql-conf=/usr/bin/mysql --with-mysql-lib=/usr/lib/mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/usr/local/bin/ruby
	--with-mysql-config
	--without-mysql-config
	--with-mysql-dir
	--without-mysql-dir
	--with-mysql-include
	--without-mysql-include=${mysql-dir}/include
	--with-mysql-lib=${mysql-dir}/lib
	--with-mysqlclientlib
	--without-mysqlclientlib
	--with-mlib
	--without-mlib
	--with-mysqlclientlib
	--without-mysqlclientlib
	--with-zlib
	--without-zlib
	--with-mysqlclientlib
	--without-mysqlclientlib
	--with-socketlib
	--without-socketlib
	--with-mysqlclientlib
	--without-mysqlclientlib
	--with-nsllib
	--without-nsllib
	--with-mysqlclientlib
	--without-mysqlclientlib

Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out

Thankfully this can be fixed fairly easily with two steps:

yum install mysql-devel
gem install mysql -- --with-mysql-config=/usr/bin/mysql_config

Success!

Please stop writing articles about Twitter.

This entry was posted April 15 2009 under Uncategorized.

4 comments

I’ve been noticing a hot new trend on the Internet lately, and I think we need to cut it off at the head. Thousands of bloggers and hundreds of print columnists are writing boring, rambling articles about their mostly homogeneous Twitter experience. The average article goes something like this:

- I heard about Twitter because Shaq/Barack Obama uses it
- I signed up and at first I didn’t really know what was going on
- Then I started liking it
- Then I made a joke about how I was limited to 140 characters
- Then I started thinking it was stupid
- But I’m still using it… until the next hot e-trend comes around!

I want this to stop. I understand that as a technology writer, it’s your job to keep abreast of current trends, but the sad fact is that you’re way late to the party and no one is interested in your bland Twitter experience. The existence of a hot new social networking website does not compel you to document your user experience. In fact, Twitter can serve to make this process much easier if you absolutely must talk about it. Just Tweet “using Twitter” and then go write an article about something that requires a little more research than just doing something that millions of people are doing every day.

Next Week: So what exactly is this “Face-book” anyway?

Great stuff I tweeted on 2009-04-04

This entry was posted April 4 2009 under Uncategorized.

No comments

Great stuff I tweeted on 2009-04-03

This entry was posted April 3 2009 under Uncategorized.

No comments
  • Serious question from a client: “Can we put the logo in the URL?” #
  • my styles be cascadin’, yo #

Great stuff I tweeted on 2009-04-02

This entry was posted April 2 2009 under Uncategorized.

No comments
  • When you finish editing a record on a website do you prefer to go back to the edit page, or the index of all records? #
  • RT @ jdickerson If I open one more tab on my browser I think they’re going to foreclose on my house. #
  • http://www.saveie6.com/ #

Great stuff I tweeted on 2009-04-01

This entry was posted April 1 2009 under Uncategorized.

No comments
  • First Stringer Bell in The Office, and now Major Colvin in How I Met Your Mother? Hoping to see Marlo Stansfield in the Full House reunion. #

Great stuff I tweeted on 2009-03-31

This entry was posted March 31 2009 under Uncategorized.

No comments
  • Snow can F RIGHT OFF. #

Great stuff I tweeted on 2009-03-30

This entry was posted March 30 2009 under Uncategorized.

No comments
  • Who knew hockey was the perfect hangover cure? #

OMG Who?

I'm Sean Roberts, a 24-year-old Ruby on Rails developer currently working for Hamilton web design firm factor[e] design initiative. This is my blog about work and nerd stuff, and maybe a little bit about music and food too.

I'm On Twitter!

  • Can anyone recommend a good tailor in Hamilton? 1 week ago
  • Alphabits are a highly underrated cereal. Just saying. 1 week ago
  • Oh look, another good deal on a product that I need and can't find at a store around here. Do they ship to Canada? Of course not. 2 weeks ago
  • RT @JayHiggins: I'm going to be positive: Games big success, Ticats sold to billionare, LRT, Condo Dev at WH, Bettman retires 3 weeks ago
  • Wait, Hamilton has a football team? 3 weeks ago
  • Hooray for west harbour! I promise to not be sarcastic RE: government for a couple days. Probably. 3 weeks ago
  • More updates...