Pregunta

Cuando hago la instalación del paquete, recibo el siguiente error:

Installing mysql2 (0.3.10) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/manish/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb 
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... 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=/Users/manish/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
--with-mysql-config
--without-mysql-config
extconf.rb:33:in ``': No such file or directory - /usr/local/bin/mysql_config --cflags    (Errno::ENOENT)
from extconf.rb:33:in `<main>'


Gem files will remain installed in /Users/manish/.rvm/gems/ruby-1.9.2-p290/gems/mysql2- 0.3.10 for inspection.
Results logged to /Users/manish/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-  0.3.10/ext/mysql2/gem_make.out
An error occured while installing mysql2 (0.3.10), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.10'` succeeds before bundling.

En Gemfile, mysql es algo como esto:

gem "mysql2", ">=0.3.0"

Y cuando también intento instalar MySQL usando Brew seguido de sudo, da un error siguiente:

 sudo: unable to execute /usr/local/bin/brew: Permission denied

¿Cómo puedo resolver esto?

¿Fue útil?

Solución

Encontré mi solución y aquí está:

Paso 1: Limpie su RVM y Xcode instalados previamente

    => rm -rf ~/.rvm    
    => sudo rm -rf /Developer

Paso 2: Instale Xcode en App Store o el instalador podría guardar en su InicentPad.

Paso 3: Instale HomeBrew:

    => mkdir -p /usr/local/Cellar
    => /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"

Paso 4: Instale RVM

    => bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
    => echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" #  Load RVM function' >> ~/.bash_profile

Paso 5: Instale Ruby 1.9.2

    => rvm install 1.9.2
    => rvm use ruby-1.9.2 --default
    => gem install rails thin bundler
    => rvm install 1.9.2-head
    => brew install git ack wget curl redis memcached libmemcached colordiff imagemagick

Paso 6: instalar mysql

    => brew install mysql
    => mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
    => mkdir -p ~/Library/LaunchAgents
    => cp /usr/local/Cellar/mysql/5.5.15/com.mysql.mysqld.plist ~/Library/LaunchAgents/
    => launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
    => mysql -u root
    => UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
    => FLUSH PRIVILEGES;

Otros consejos

Puede descargar las bibliotecas y pasar en su ubicación manualmente al proceso de construcción de gemas como banderas, pero eso es un poco doloroso.

MySQL estaba buscando en/usr/local/bin, lo que tiene sentido para una instalación casera, pero si sudo brew no funciona, hay un problema de permisos y es probable que tenga muchos más problemas para venir.

Arreglaría honestamente b/c que continuará frustrando. Danza normal para solucionar: permisos de reparación utilizando la utilidad de disco, ejecute Brew Doctor para verificar los problemas, imponer y reinstalar si las cosas se ponen mal.

Buena suerte

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top