Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8621889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:55:15+00:00 2026-06-12T06:55:15+00:00

ok, feel super dumb about asking a question that’s apparently been asked multiple times.

  • 0

ok, feel super dumb about asking a question that’s apparently been asked multiple times. apologies in advance.

am following this tutorial: http://squarism.com/2011/04/01/how-to-write-a-ruby-rails-3-rest-api/

it requires mysql2 …

tried to install it via “gem install mysql2”

this is what i get:

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

    /Users/name_withheld/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
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... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
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
--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=/Users/name_withheld/.rvm/rubies/ruby-1.9.3-p194/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
--without-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
--with-mygcclib
--without-mygcclib
--with-mysqlclientlib
--without-mysqlclientlib


Gem files will remain installed in /Users/name_withheld/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11 for inspection.
Results logged to /Users/name_withheld/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/ext/mysql2/gem_make.out

so, poked around and saw this solution being proposed multiple times:

sudo apt-get install libmysql-ruby libmysqlclient-dev

unfortunately, i get: “command not found” …

kind of at loss …

wanted to do it via homebrew (since it seemed “simple”) … but there are several problems with that …

  • really unfamiliar with it …
  • not sure if i have it or not …

so, tried brew update to see what i’d get … this is what i got:

/usr/local/.git: Permission denied
Error: Failure while executing: git init 

so … tried to delete it via this code from here: https://gist.github.com/1173223

it doesn’t seem to have done anything, and it kind of froze up, so quit it …

not sure what to do now … first priority is clearly trying to get mysql2 gem installed if possible … homebrew is just side stuff …

any other information needed here? any clarification need with my question? and sorry, didn’t mean to make this question so long! just trying to cover as many bases as possible.

thanks in advance.

oh, my version of mac is 10.6.8 if that makes any difference …

just tried one more thing: “brew install mysql” (via another stackoverflow question)

this is what i get:

Error: Cannot write to /usr/local/Cellar
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:55:17+00:00Added an answer on June 12, 2026 at 6:55 am

    A few things:

    apt-get is a package installation tool for Linux, so those commands won’t work with your Mac.

    You have a permissions issue with your /usr/local directory which is causing the errors with brew update and brew install. To fix this, you can give yourself ownership with the following command:

    sudo chown -R $USER /usr/local
    

    There are some caveats with this, so check out this thread: Installing in Homebrew errors

    Next, you don’t have the mysql installed. The mysql2 gem does not install mysql; it is simply a Ruby library that allows you to connect to a running mysql process with Ruby code. I don’t believe you can install the gem unless the process is installed and running, which explains that big ugly stack trace from gem install mysql2.

    So, after you update your /usr/local permissions, retry brew install mysql and follow the instructions to get the service running. You can confirm that it’s working if you see mysqld or mysqld_safe daemon process running with a command like ps ax | grep mysqld. Assuming that works, you should then be able to install the mysql2 gem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may be a super dumb question, that I feel like I should know
I feel super fail asking this... but I've been trying to make sure my
In my heart, I feel that there must be a super simple recursive solution
Feel free to close and/or redirect if this has been asked, but here's my
I have a super long jquery snippet that I feel could be simplified with
I feel foolish asking such a fundamental question but it would be more foolish
I actually feel a little embarrassed asking this because it feels about as basic
I feel silly for asking, but how do I get plan value in this
I feel like such a noob asking this but, for some reason a horizontal
I feel bad because it is very likely this has already been answered and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.