Can't install rmagick gem on Mountain Lion - ruby-on-rails-3

Note: my situation is almost identical to this: Can't install pg gem on Mountain Lion.
I just upgraded from Snow Leopard to Mountain Lion and Rails is giving me all kinds of problems, especially trying to install the 'rmagick' gem. I'm running Ruby 1.9.3-p362 and Rails 3.2.11.
➜ git:(master) ✗ sudo gem install rmagick -v 2.13.1
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc-4.2... yes
checking for Magick-config... yes
Warning: Found more than one ImageMagick installation. This could cause problems at runtime.
/opt/local/bin/Magick-config reports version 6.6.6 Q8 is installed in /opt/local
/OPT/LOCAL/BIN/Magick-config reports version 6.6.6 Q8 is installed in /opt/local
/USR/LOCAL/BIN/Magick-config reports version 6.8.0 Q16 is installed in /USR/LOCAL/Cellar/imagemagick/6.8.0-10
Using 6.6.6 Q8 from /opt/local.
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... *** 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/sscirrus/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
/Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:834:in `block in have_header'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:833:in `have_header'
from extconf.rb:193:in `<main>'
Gem files will remain installed in /Users/sscirrus/.rvm/gems/ruby-1.9.2-p320/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/sscirrus/.rvm/gems/ruby-1.9.2-p320/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
➜ applyco git:(master) ✗ brew install imagemagick --disable-openmp
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
Error: imagemagick-6.8.0-10 already installed
➜ applyco git:(master) ✗ apt-get install libmagick9-dev
zsh: command not found: apt-get
I have tried:
Installing Xcode with command line tools
Reinstalling homebrew
Clearing out all my repo's gems (including Gemfile.lock) and running bundle install
Reinstalling the bundler gem
Reinstalling ImageMagick
Nothing, including answers elsewhere on SO, have been of any use. Can you point me in the right direction?

I had the same problem as you setting up my dev environment on Mountain Lion for RoR 3.2.11. Apparently the last version of RMagick (2.13.1 ) doesn't play nice compiling with the last version of ImageMagick (6.8.2-0). Disabling openmp and building from source worked like, ahem.. Magick.
brew uninstall imagemagick
brew install imagemagick --disable-openmp --build-from-source
gem install rmagick
I didn't need to edit the brew formula described in http://blog.paulopoiati.com/2013/01/28/installing-rmagick-in-mac-os-x-mountain-lion-with-homebrew/, but that would be the next step to try.

I am going through the same issue here...
But one difference, maybe your homebrew its linked to another version of Imagemagick.
So even though imagemagick-6.8.0-10 is installed is not being found.
Try something like
brew unlink imagemagick
then brew link imagemagick
and see what happens.
This fixed my problem
http://robots.thoughtbot.com/post/27985816073/the-hitchhikers-guide-to-riding-a-mountain-lion

It may be a permissions issue try running
sudo chown -R `whoami` /usr/local
and then try again.

I had the same issue while trying to use Paperclip with Rails 3 for the first time.
Just to sum up previous answers, what worked for me was the following:
sudo chown -R `whoami` /usr/local
brew link --overwrite imagemagick
Thanks!

Related

bootstrap 4.2.1 `bundle install` error occurred while installing ffi (1.10.0)

I am trying to run bundle install on bootstrap 4.2.1 and get this error
An error occurred while installing ffi (1.10.0), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.10.0' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
jekyll-redirect-from was resolved to 0.14.0, which depends on
jekyll was resolved to 3.8.5, which depends on
jekyll-sass-converter was resolved to 1.5.2, which depends on
sass was resolved to 3.7.3, which depends on
sass-listen was resolved to 4.0.0, which depends on
rb-inotify was resolved to 0.10.0, which depends on
ffi
What I tried:
did everything on https://github.com/twbs/bootstrap
ran gem install ffi -v '1.10.0' --source 'https://rubygems.org/' and gem install ffi
installed / updated ruby
brew install openssl libyaml libffi
xcode-select --install
Tried everything 20 times all over
People say this is a mac Mojave issue... I searched all other questions and there are no working fixes.
How to fix it?
Issue was fixed after installing xcode from mac store that weighs over 10gb just for couple of dependesis
The suggestion by vladhadzhiyski to run brew reinstall libffi worked for me:
$ brew reinstall libffi
==> Reinstalling libffi
==> Downloading https://homebrew.bintray.com/bottles/libffi-3.2.1.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libffi-3.2.1.mojave.bottle.tar.gz
==> Caveats
libffi is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of libffi.
For compilers to find libffi you may need to set:
export LDFLAGS="-L/usr/local/opt/libffi/lib"
For pkg-config to find libffi you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
==> Summary
🍺 /usr/local/Cellar/libffi/3.2.1: 16 files, 296.8KB
$ export LDFLAGS="-L/usr/local/opt/libffi/lib"
$ export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
$ bundle install

Unable to install Cocoapods on Yosemite DP 7

I am having trouble installing Cocoapods on Yosemite DP 7 installed on a separate partition. I already attempted following the instructions found on Cocoapods with Xcode 6 and 10.10 Yosemite and in the issue(https://github.com/CocoaPods/CocoaPods/issues/2219) closed due to the same solution proposed on the Stack Overflow link.
I continue to get the following error:
Rasmuss-MacBook-Pro:~ rasmusth$ sudo gem install cocoapods
Building native extensions. This could take a while...
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby" -rubygems /Library/Ruby/Gems/2.0.0/gems/rake-0.9.6/bin/rake RUBYARCHDIR=/Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/ext RUBYLIBDIR=/Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/ext
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for -std=c99 option to compiler... *** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `block in try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:502:in `with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile'
from extconf.rb:24:in `block in <main>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
from extconf.rb:23:in `<main>'
rake aborted!
Command failed with status (1): [/System/Library/Frameworks/Ruby.framework/...]
/Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/ext/xcodeproj/Rakefile:37:in `block in <top (required)>'
Tasks: TOP => default => ext
(See full trace by running task with --trace)
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/ext/xcodeproj/gem_make.out
I am suspecting that this may have to do with the fact that I have Yosemite on a separate partition, but otherwise I am clueless.
I ran into the same issue. After much hair pulling following the same steps as everyone else, the following worked.
$ xcode-select --install (to confirm command line tools are installed)
Installed nvm stable (and homebrew): $ \curl -sSL https://get.rvm.io | bash -s stable
close/reopen terminal
Installed ruby 2.1.2: $ rvm install 2.1
Switch to it: $ rvm use 2.1
Uninstall/reinstall xcodeproj and cocoapods
Xcode 6.0 GM is missing the 10.10 SDK and therefore the gem xcodeproj can't be compiled which has some C code in it which needs the 10.10 SDK.
This is going to be fixed in the future.
For now you can work around it like this:
Terminal: sudo gem uninstall cocoapods xcodeproj
Download Xcode 6.1 (right now Beta 2 is the current one)
Start it go to Settings -> Location -> Command Line Tools -> Change to Xcode 6.1 Beta
Terminal: sudo gem install cocoapods
Change your Command Line tools back to GM (if you want/need)
For more information see: https://github.com/CocoaPods/CocoaPods/issues/2432

Error "...cannot load such file -- mysql2/2.0/mysql2 (LoadError)". On Windows XP with Ruby 2.0.0

The command rails server throws this error.
C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load
such file -- mysql2/2.0/mysql2 (LoadError)
I use Ruby 2.0.0 from RubyInstaller on Windows XP box.
I figured out what is the problem but I don't know how to solve it. The problem is that there is no any 2.0/ directory in the mysql2-0.3.11-x86-mingw32 gem. This is the gem that rails installs as its dependency from Gemfile:
GEM
remote: https://rubygems.org/
specs:
... many gems here
mysql2 (0.3.11-x86-mingw32)
... many gems here
DEPENDENCIES
...
mysql2
...
This is what is in that mysql2.rb file:
# C:\Ruby200\lib\ruby\gems\2.0.0\gems\mysql2-0.3.11-x86-mingw32\lib\mysql2\mysql2.rb
RUBY_VERSION =~ /(\d+.\d+)/
require "mysql2/#{$1}/mysql2" # <<-- this is that #2 line that throws an error
It is obvious that it takes the current Ruby version number and uses it as the path segment to reach some mysql2 file. In fact it is mysql2.so file. As I use Ruby 2.0.0 the path segment is 2.0:
mysql2/2.0/mysql2
Ok, now lets see how that directory of mysql2-0.3.11-x86-mingw32 gem looks like:
dir: C:\Ruby200\lib\ruby\gems\2.0.0\gems\mysql2-0.3.11-x86-mingw32\lib\mysql2\
No any 2.0/ directory.
I know the issue about libmysql.dll. I have it in my C:\Ruby200\bin. It doesn't help.
I read this answer https://stackoverflow.com/a/5368767/1114926 from the creator of RubyInstaller. I tried but it didn't help. It works for Ruby 1.9.3 because there is 1.9/ directory. But it doesn't work for Ruby 2.0.0.
How to solve it?
UPD 1:
Thank you for your answer. I've tried. Unfortunately I have ERROR: Failed to build gem native extension. error:
C:\>gem install mysql2 --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
C:/Ruby200/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... *** 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=C:/Ruby200/bin/ruby
C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed to generate an executable file. (Runtim
eError)
You have to install development tools first.
... other code follows here...
It says:
You have to install development tools first.
But I have full DevKit installed, RubyInstaller installs it. Can't understand what else does it need.
I've already posted an issue to mysql2 GitHub page https://github.com/brianmario/mysql2/issues/364. No answers yet.
Had the absolutely same issue on Windows 7 x64 with Ruby 2.0.0 and DevKit 4.7.
The following steps helped me.
gem uninstall mysql2
Download last MySQL connector from http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip
Extract it to C:\connector-6.0.2
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\connector-6.0.2\lib" --with-mysql-include="C:\connector-6.0.2\include" --with-mysql-dir="C:\connector-6.0.2"'
Or even shorter:
gem install mysql2 --platform=ruby -- --with-opt-dir="C:\connector-6.0.2"
uninstall mysql2-0.3.11-x86-mingw32, gems compiled before Ruby200 won't work. You have to compile it yourself.
If you run gem uninstall mysql2 and there is a non compiled version listed then just uninstall mysql2-0.3.11-x86-mingw32 - the compiled version else...
Installation
gem install mysql2 --platform=ruby. that would work.
Follow this guide on installing devkit http://rubyonwindowsguides.github.com/book/ch02-04.html.
Then try again.
Exactly the same behavior when I try to install Redmine on windows XP
when I try to do the "rake generate_secret_token", I got "cannot load
such file -- mysql2/2.0/mysql2 (LoadError)"
and when I try to re build mysql2 using --platform=ruby, I got the
same message as you green.
for the moment, I am stucked there ... but if anybody has anything to allow me to move forward, it will be very welcome.
I will keep informed as well
antoine
I almost done the same what #odiszapc described. Uninstall old gem, download mysql-connector-c-noinstall, unzip, but finally I used this command to build native gem:
gem install mysql2 --platform=ruby -- --with-opt-dir=/c/connector-6.0.2
(If you use git-bash then you can use unix style directory syntax.)
Copy paste from that link: https://github.com/brianmario/mysql2/issues/359. It worked for me.
If after installing the gem, you get an error:
"The specified module could not be found.
C:/Devel/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11/lib/mysql2/mysql2.so"
That can be fixed by copying libmysql.dll to Ruby's bin folder.

Installing rmagick on osx 10.7.3 crashed

I got a problem to install rmagick on my osx 10.7.3 lion
I used rvm
Imagemagick is installed with homebrew
gem install rmagick
Fetching: rmagick-2.13.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension
/Users/lion/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for clang... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... *** 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/lion/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
/Users/lion/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:381:in
try_do': The compiler failed to generate an executable file.
(RuntimeError)
You have to install development tools first.
from /Users/lion/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:506:in
try_cpp'
from /Users/lion/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:931:in
block in have_header'
from /Users/lion/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:790:in
block in checking_for'
from /Users/lion/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:284:in
block (2 levels) in postpone'
from /Users/lion/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:254:in
open'
from /Users/lion/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:284:in
block in postpone'
from /Users/lion/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:254:in
open'
from /Users/lion/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:280:in
postpone'
from /Users/lion/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:789:in
checking_for'
from /Users/lion/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:930:in
have_header'
from extconf.rb:193:in'
Gem files will remain installed in /Users/lion/.rvm/gems/ruby-1.9.3-p0/gems/rmagick-2.13.1 for
inspection.
Results logged to /Users/lion/.rvm/gems/ruby-1.9.3-p0/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
Did anyone know what i can do to install rmagick correctly?
I'm going to take a guess that it's an upgrade and not pre-installed? I recently upgraded to Lion and had to do something like:
uninstall xcode 3 (there's a non-destructive version of the uninstall script in case you care)
install xcode 4 (free from the app store. big download).
i use macports. i had to uninstall and reinstall them all. you'll need to do the same for homebrew if you haven't already.
symlink or pass on command line the new gcc compiler (rmagick references gcc-4.2, but with xcode 4 it's called llvm-gcc-4.2. look up what that means if you're interested http://llvm.org/)
That pretty much sums up what I had to do. The clue was in the mkmf.log, so definitely look in there and update your question if my answer doesn't do it for you.

bundle install problem: mysql.h is missing

in my mac OSX 10.6 32 bit, I can install mysql2 gem quite easily, but not in mini mac 10.6 64bit server.
I have installed MySQL 5.5.11 in troublesome server, while in my home mac MySQL 5.5.0.m2
Somehow when I run bundle install, in server it tries to install mysql2.0.3.2 while in home mysql2.0.2.6
Please don't tell me to
env ARCHFLAGS="-arch x86_64" sudo gem install mysql2 --version '= 0.2.6' -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
I tried that, doesn't work.
Included /usr/local/mysql/bin in $PATH does not help as well.
Error code:
Installing mysql2 (0.3.2) with native extensions /Users/administrator/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/administrator/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try again.
-----
*** 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/administrator/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
--with-mysql-config
--without-mysql-config
Gem files will remain installed in /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2 for inspection.
Results logged to /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2/ext/mysql2/gem_make.out
from /Users/administrator/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:511:in `block in build_extensions'
from /Users/administrator/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `each'
from /Users/administrator/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `build_extensions'
from /Users/administrator/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:159:in `install'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/source.rb:96:in `install'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/installer.rb:55:in `block in run'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `block in each'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `each'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `each'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/installer.rb:44:in `run'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/installer.rb:8:in `install'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/cli.rb:225:in `install'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/vendor/thor/base.rb:389:in `start'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/bin/bundle:13:in `<top (required)>'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/bin/bundle:19:in `load'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/bin/bundle:19:in `<main>'
I tried all the solutions posted here, but was not lucky. I reinstalled mysql with homebrew a couple of times and still no luck. Then I came across a blog post with a solution.
I edited the mysql_config file in /usr/local/Cellar/mysql/5.6.12/bin and removed
the W-compiler options
-Wno-null-conversion and
-Wno-unused-private-field
for cflags and cxxflags.
This solved the problem with gem install mysql2 and bundle install
Reference: http://www.randomactsofsentience.com/2013/05/gem-install-mysql2-missing-mysqlh-on-os.html
I did a bundle install on a redmine repo and got the same error message :
mysql.h is missing. please check your installation of mysql and try again.
Running Fedora 16 64 bits, all I did was install mysql-devel (development package) from the distro rpm and the problem was solved!
So I think you could just
yum install mysql-devel
or apt-get the missing devel package.
for people who didn't use brew to install mysql and use mysql 5.6 and higher:
according to this answer
you need to edit mysql_config which was placed in my case here: /usr/local/mysql-5.6.12-osx10.7-x86_64/bin
and change cflags and cxxflags to:
cflags="-I$pkgincludedir -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!
cxxflags="-I$pkgincludedir -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!
after this manipulations
$ gem install mysql2 -v '0.3.13'
goes flawlessly
Ok guys for me the solution was:
$ sudo brew install mysql
$ sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
--with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \
--with-mysql-include=/usr/local/mysql/include
source: http://wonko.com/post/how-to-install-the-mysqlruby-gem-on-mac-os-x-leopard
OR :
$sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- \
--with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \
--with-mysql-include=/usr/local/mysql/include
If your mysql version is 64Bits
After that i had a lot of problems because if i want to create the database:
$: bundle exec rake db:reset
i was receiving this error:
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /Users/workdreamer/Sites/cavortify/implementation/cavortify/mysql/ruby/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_init
Referenced from: /Users/workdreamer/Sites/cavortify/implementation/cavortify/mysql/ruby/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
The solution is: On your gemfile add: gem "ruby-mysql"
Ok, one day and a half to find the solution.
Have a nice day!
This method is for Rails 3.1.0 (and hopefully up) on 64 bit machine. I used on Ruby-1.9.2-p180.
This blog answered it: http://www.tatvartha.com/2010/10/installing-mysql-gem-with-bundler-on-snow-leopard/
Basically, the method above: $ sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
may work, but without bundler.
To do it with bundler, first must run this on terminal:
bundle config build.mysql2 --with-mysql-config=/usr/local/mysql/bin/mysql_config
Note "mysql2" not "mysql" as shown in that blog.
That adds a config to ~/.bundle/config file
Then add this to ~/.bash_profile:
export ARCHFLAGS="-arch x86_64"
That is the same with telling bundler to run the command on top of this post.
The only way I could get this to work was to install the x64 version of mysql. I just used the .dmg located here http://dev.mysql.com/downloads/mysql/ and it worked like a charm. Wish I could get the 4 hours back it took to figure this out.
This worked for me on my Mac OSX Lion:
sudo env ARCHFLAGS="-I/usr/local/include/mysql/mysql -pipe -fPIC -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL" gem install mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/lib/mysql/mysql --with-mysql-include=/usr/local/include/mysql/mysql --with-mysql-config=/usr/local/bin/mysql_config
This blog answered it.
My problem was the result of first installing MySql via the downloadable binary. It was originally installed at version 5.5.28. I then attempted to install via homebrew. Brew installed version 5.6.x. HOWEVER in the process of installing via homebrew, the symlink for /usr/local/mysql was still pointed to 5.5.28.
Update your symlink to whichever version was installed via homebrew.
ex: /usr/local/mysql -> /usr/local/Cellar/mysql/5.6.13/
This could be just part of the solution.
For mariadb:
sudo apt-get install libmariadbclient18 libmariadbclient-dev
Then
gem install mysql2
could be successfully installed.
Verify that gcc is installed. If it isn't, you will get that same error message.
You can check the results/log file it mentions for more clues as to the cause.
Posting this wherever I can--hopefully it will help someone and save them a lot of time.
I dug through 2 days worth of the internet and Stack Overflow, and it wasn't until I found this link and then starting working through this ticket for mysql2 that I actually resolved the issue.
With my setup (as explained in the ticket), the compiler switches of -Wno-null-conversion -Wno-unused-private-field would break and give me an error that wasn't exactly correct, which was:
mysql.h is missing. please check your installation of mysql and try again
For those on Fedora 21, and you already installed mysql-devel:
yum install redhat-rpm-config
solved the problem for me. see:
redhat docs
TL;DR:
sudo ln -s /usr/local/opt/mysql#5.6 /usr/local/mysql
I got stumped by this issue for almost 2 days and reinstalled xcode and mysql so many times.
I originally had mysql#5.6 installed using brew, but the bundle install command kept failing because it could not find a mysql installation. Error output below:
libmysqlclient is missing. You may need to 'brew install mysql' or 'port install mysql', and try again.
However, using #Kevin Boedigheimer's answer helped fixed the problem i.e. I linked the installed mysql#5.6 to /usr/local/mysql
sudo ln -s /usr/local/opt/mysql#5.6 /usr/local/mysql
N.B: In case your mysql directory is somewhere else, you can find it using:
find / -name 'mysql*5.6' 2&> /dev/null
# '2&> /dev/null' ensures you have just the output you need