Mac OS 10.14 Mojave + qt5.5 + gem capybara-webkit - macos

My config is MAC Mojave v10.14.
I try to install gem Capybara-webkit -v '1.15.0' which need qt5.5, but qt5.5 has been dropped of the homebrew and it is not compatible with Xcode v10.
I try this :
Uninstall Xcode v10
Install Xcode 9.4.1, found in developer.apple.com/
Install qt5.5, I have found it in the archives on qt.io/
Run bundle
But it fail, my error is with the gem capybara-webkit -v '1.15.0':
Fetching capybara-webkit 1.15.0
Installing capybara-webkit 1.15.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/Users/thomas/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/capybara-
webkit-1.15.0
/Users/thomas/.rbenv/versions/2.4.4/bin/ruby -r ./siteconf20181005-763-1bppnfh.rb extconf.rb
Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
*** 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/thomas/.rbenv/versions/2.4.4/bin/$(RUBY_BASE_NAME)
--with-gl-dir
--without-gl-dir
--with-gl-include
--without-gl-include=${gl-dir}/include
--with-gl-lib
--without-gl-lib=${gl-dir}/lib
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
Command 'qmake ' failed
extconf failed, exit code 1
Gem files will remain installed in
/Users/thomas/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/capybara-webkit-1.15.0 for inspection.
Results logged to /Users/thomas/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/extensions/x86_64- darwin-18/2.4.0-static/capybara-webkit-1.15.0/gem_make.out
An error occurred while installing capybara-webkit (1.15.0), and Bundler
cannot continue.
Make sure that `gem install capybara-webkit -v '1.15.0' --source
'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
capybara-webkit
Next, I did:
sudo xcodebuild -license agree
But the error persists...
Thank you for your help !

As described on the capybara-webkit wiki, capybara-webkit depends on Qt 5.5. "Qt 5.5 is the last version of Qt that capybara-webkit will support. The Qt project has dropped the WebKit bindings from binary releases in 5.6."
To install Qt 5.5 follow the instructions from the wiki. For Mojave, the instructions are the following.
brew update
cd $( brew --prefix )/Homebrew/Library/Taps/homebrew/homebrew-core
git checkout 9ba3d6ef8891e5c15dbdc9333f857b13711d4e97 Formula/qt#5.5.rb
brew install qt#5.5
echo 'export PATH="$(brew --prefix qt#5.5)/bin:$PATH"' >> ~/.bashrc
You can confirm this step worked by running:
$ which qmake
/usr/local/opt/qt#5.5/bin/qmake
Next, you need to install Xcode 9.4. Xcode 10 is not compatible with Qt 5.5. Xcode 9.4 can be downloaded from the Apple developer portal. This is a 4GB download and takes about 30 minutes to download and install. You can verify it's correctly installed by running the following:
$ /usr/bin/xcodebuild -version
Xcode 9.4.1
Build version 9F2000
If this doesn't work, it may be because you have only the Command Line Tools installed instead of Xcode, in which case you should make sure you downloaded the right version of Xcode. Or the Xcode folder may set incorrectly. If so, you can fix this using xcode-select, which will specifiy the folder in which xcodebuild runs:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
When Xcode is finally installed, locate it in your Applications folder, open it, and agree to the license. Then try reinstalling capybara-webkit.
Disclaimer: I came up with the above answer from compiling multiple questions and answers and trying to remember the order in which I ran commands on my local machine. I may have accidentally omitted some steps.

Here's what worked for me, found here:
Keep your xcode v10 installed
Manually download and install Qt 5.5 from their website
Add Qt's bin path to your PATH environment variable by adding this to your .bashrc, .zshrc or any other shell configuration that you have: (make sure to replace /Applications/Qt/5.5/clang_64/bin with your Qt bin path)
export PATH="/Applications/Qt/5.5/clang_64/bin:$PATH" # Add Qt bin to path for capybara webkit to work
Run gem install capybara-webkit

I think my problem was with xcrun. For fix I did :
sudo chown root:wheel /Applications/Xcode.app
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
cd /Applications/Xcode.app/Contents/Developer/usr/bin/
sudo ln -s xcodebuild xcrun
And it work (y) !

You need Xcode 9.4.1 to install qt#5.5 as it's not compatible with Xcode 10. Homebrew has deleted the qt#5.5 from their core tap so to install it you need to run the following before:
brew update
cd $( brew --prefix )/Homebrew/Library/Taps/homebrew/homebrew-core
git checkout 9ba3d6ef8891e5c15dbdc9333f857b13711d4e97 Formula/qt#5.5.rb
brew install qt#5.5
9ba3d6ef8891e5c15dbdc9333f857b13711d4e97 is the parent commit of 360923286c0f1a6a1325ada578df030bf579009f where they removed qt#5.5 so this command rollbacks to the parent commit and checkout the needed formula file.

I could install qt#5.5 on Mojave with this:
brew install qt#5.5 --force-bottle
With capybara-webkit, I temporarily use this:
gem "capybara-webkit", git: "https://github.com/emilyst/capybara-webkit.git", ref: "9c9af833656f095667e8522004dae017d423d37d"

Related

Error installing CocoaPods - macOS BigSur

I'm learning how to program, and I am trying to install Cocoapods, but I'm getting an error with sudo gem install cocoapods.
This is what I get:
Building native extensions. This could take a while...
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20201006-615-fryp4a.rb extconf.rb
checking for ffi.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=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib
--enable-system-libffi
--disable-system-libffi
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467: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.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `block in try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:534:in `with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1109:in `block in have_header'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1108:in `have_header'
from extconf.rb:10:in `system_libffi_usable?'
from extconf.rb:42:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/ffi-1.13.1/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/ffi-1.13.1/gem_make.out
I know that there is a line where it says "You have to install development tools first", and at first it was true. I then installed the Xcode command line tools (I had to do it manually downloading it from Apple Developer because the xcode-select --install line didn't work), and tried to install cocoapods again. But I'm getting the same error, even after rebooting.
It also has the route for the log, and this is what it says:
package configuration for libffi is not found
"xcrun clang -o conftest -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin20 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/backward -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -g -Os -pipe -DHAVE_GCC_ATOMIC_BUILTINS -DUSE_FFI_CLOSURE_ALLOC conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib -L. -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.Internal.sdk/usr/local/lib -lruby.2.6 "
In file included from conftest.c:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found
#include "ruby/config.h"
^~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10: note: did not find header 'config.h' in framework 'ruby' (loaded from '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks')
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
So, I'm stuck.
I'm currently using macOS Big Sur Beta 9, and Xcode 12.0.1 (non-beta).
I had the same issue (Catalina 10.15.7 & Xcode 12.3).
I used homebrew instead of the gem:
brew install cocoapods
XCode's ruby framework appears to have a problem. Reinstall Xcode.app cleanly with the latest version and running xcode-select --install or --select did not work for me.
This is how I managed to make it run with XCode 12.2 and Catalina (10.15.7): https://stackoverflow.com/a/65481787/1534182
TL;DR)
cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby
ln -sf ../../../../Headers/ruby/config.h
cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0
ln -sf universal-darwin20 universal-darwin19
(edit fixed typo in symlink)
Solve by upgrading Xcode to 12.2 on macOS Big Sur.
Then run:
sudo gem install -n /usr/local/bin cocoapods
Wasted 5 hours because I thought it was a gem's issue.
or if you already installed the cocoa pods just run
brew install cocoapods
after its showing some warning message
Warning: cocoapods 1.10.1 is already installed, it's just not linked.
To link this version, run:
brew link cocoapods or
brew link --overwrite cocoapods
it was really helpful for me. thank you
Well, today I was able to finally install Cocoapods successfully, but it was a weird process.
When learning people usually tell you to stay away from betas, and while I was in the stable AppStore-version of Xcode, I was running Big Sur B9; and that could have been the problem.
I completely uninstalled Xcode 12.0.1 and then downloaded from Apple Developer Xcode 12.2 beta. I then downloaded and installed the command line tools also for 12.2 beta, and ran again the cocoapods installation in Terminal… and voila!
After installing and running Xcode beta I was able to install and now works fine.
Maybe when BigSur becomes public this will be solved? Because not everyone needs or has to run Xcode beta versions.
I've faced the exact same issue
$ sudo gem install cocoapods
...
checking for ffi.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.
...
Fixed by upgrading ruby version to 2.7.2.
Credits for https://stackoverflow.com/a/65033418/4982169
I use rbenv to manage ruby versions.
This worked for me:
https://github.com/CocoaPods/CocoaPods/issues/10286#issuecomment-747512270
Quote:
Download Command Line Tools 11.5 from Apple Developer Downloads
sudo rm -rf /Library/Developer/CommandLineTools
Install Command Line Tools from .dmg/.pkg
sudo xcode-select --switch /Library/Developer/CommandLineTools
[sudo] gem install [--user-install] cocoapods
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Above sols. might or might not work for everyone, but just make sure to cross check command line tools.. It must be set and not blank.
I had the same error over and over again and tried several ways to fix it, including many described here, with no success.
As explained here: https://developer.apple.com/forums/thread/668456
, depending on some aspects this might work for you as it did for me!
run sudo gem install -n /usr/local/bin cocoapods -v 1.8.4
Apparently the later cocoapads versions,specially latest (1.11.2) wont work!
Switching the default Xcode command-line tools from version 12.4 to 11.7 solved this problem for me.
I have both Xcode versions installed on Catalina (10.15.7), so I made the switch using Xcode Preferences (Locations/Command Line Tools:), selecting "Xcode 11.7" in the popup menu. Then I quit Xcode and ran the install command again:
sudo gem install cocoapods
Where before I was getting the same "missing header" error, now the install proceeded without incident.
Command-line tools can be installed separately, without having to install Xcode itself. Then you would use Terminal to switch versions. The path to the current default tools is returned by
xcode-select -p
and switching versions is done using
sudo xcode-select -s {path-to-tools}
After installing CocoaPods I switched back to the latest command-line tools and did 'pod install' on one of my current projects, which succeeded without incident. So the earlier version seems necessary only for CocoaPods install, not its operation.
update the latest version ruby:
https://www.delftstack.com/howto/ruby/update-ruby-version-in-macos/
and check version ruby:
ruby -v
and then:
sudo gem install cocoapods

How to install ruby-debug when needing necessary libraries and/or headers

My Rails is 3.2.1.4, Ruby is 1.9.3p448.
I got an error when I install ruby-debug:
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug:
ERROR: Failed to build gem native extension.
/home/hxh/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
Can't handle 1.9.x yet
*** 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=/home/hxh/.rvm/rubies/ruby-1.9.3-p448/bin/ruby
Gem files will remain installed in /home/hxh/.rvm/gems/ruby-1.9.3-p448/gems/linecache-0.46 for inspection.
Results logged to /home/hxh/.rvm/gems/ruby-1.9.3-p448/gems/linecache-0.46/ext/gem_make.out
Who can tell me where the error is?
The error is in the mkmf.log file. That file should be located at /home/hxh/.rvm/gems/ruby-1.9.3-p448/gems/linecache-0.46/ext/linecache/mkmf.log.
If not, you can use
sudo find / -name mkmf.log
to find it.
To troubleshoot further, see "How to install Nokogiri Ruby gem with mkmf.log saying libiconv not found?"
I am using Mac El Capitan. In my case it was caused by the missing developer tool. I solved it by installing the developer tool via xcode-select --install. After that bundle install worked fine again.
You're most likely missing some file headers (e.g. zlib or libiconv), so try installing them.
Linux: sudo apt-get install libz-dev libiconv-hook1 libiconv-hook-dev
OS X: brew install libiconv && xcode-select --install
Otherwise check your mkmf.log file for more specific details.
I was facing the same issue running MacOS Big Sur version 11.1 and Xcode Version 12.4 (12D4e). In my case there was no command-line tool selected in Xcode.
I just followed the following steps to fix the problem:
Start Xcode.
Open the preferences using ⌘+,.
Select the Locations tab.
Select command-line tool (Xcode 12.4 12D4E in my case).
Run sudo gem install cocoapods (in my case).
It seems to be a issue with permission of gcc.. however, if you're using OS X, you may encounter this issue if you've updated your XCode but haven't agree to their terms & conditions yet.. try typing gcc in your terminal would show you what if you've agreed.
My mkmf.log showed that gcc (4.8.2 I think) didn't like a specific argument that was being used by atomic on
$ gem install atomic
So I had a very similar situation. The answer for me was to upgrade gcc/gcc-libs and lib tool.
I use Arch linux, and only Arch linux. The proper way to do this is to run
$ sudo pacman -Syu
which upgrades all system packages.
I installed Rails and hadn't run a system update since, which is where the issue came from. In most other *nix distros, you would update to the latest version of these packages by name, i.e. with apt, it would be something along the lines of
$ sudo apt-get update
followed by
$ sudo apt-get upgrade {package-name}
For what it's worth, using Ruby 2.0.0 I was having this problem on OSX 10.10.
I ended up running brew update, which resolved some conflicts, then installed the gem and it was fine.
The answer of kenorb worked for me on Ubuntu 16.04 when I was trying installing rails! Thanks!
I followed these steps below for installing rails:
sudo apt-get install ruby-full
sudo apt-get install libz-dev libiconv-hook1 libiconv-hook-dev
sudo gem install rails
I had the issue because gcc wasn't available on my machine.
Fixed it by installing gcc.
sudo apt install build-essential
This worked for me. Nokogiri was the problem.
Try the following if you are using Alpine-Linux(or equivalent command for your OS):
apk add build-base
And then install Nokogiri using:
gem install nokogiri -- --without-pkg-config --with-libxml-2.0-config
Took me a while to successfully install it.
Install cocoapods with HomeBrew brew install cocoapods && brew link --overwrite cocoapods
Verify your cocoapods version pod --version
This is probably happening because your computer has an older version of Ruby, so first update Ruby. This worked for Ruby 2.6.3+.
Open terminal and enter:
curl -L https://get.rvm.io | bash -s stable
Then:
rvm install ruby-2.6
This will install Ruby for you if it wasn't already installed, then update Ruby to the new version:
rvm use ruby-2.6.3
This will possibly fix your issue. You can now enter:
sudo gem install cocoapods
pod setup
If RVM is not installed in your system, then use:
$HOME/.rvm/scripts/rvm
rvm
The problem is resolved with next command: sudo apt install build-essential
This worked for me:
sudo apt-get install libmysqlclient-dev
Install RVM and use it to install Ruby 2.6.x:
curl -sSL https://get.rvm.io | bash
rvm install 2.6.x
rvm use ruby-2.6.x
Now try and it should work:
sudo gem install cocoapods

Ruby gem rmagick won't install on Mac OS X

I understand that this question has been asked a lot earlier, but none of the solutions worked for me and I'm really desperate right now.
I'm trying to get rMagick to install using gem for an installation of diaspora. I already installed imagick via homebrew and when trying to run gem install rmagick I receive this error:
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/tobischweiger/.rvm/rubies/ruby-1.9.3-p385/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc-4.2... yes
checking for Magick-config... no
Can't install RMagick 2.13.2. Can't find Magick-config in /Users/tobischweiger/.rvm/gems/ruby-1.9.3-p385#diaspora/bin:/Users/tobischweiger/.rvm/gems/ruby-1.9.3-p385#global/bin:/Users/tobischweiger/.rvm/rubies/ruby-1.9.3-p385/bin:/Users/tobischweiger/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin
*** 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/tobischweiger/.rvm/rubies/ruby-1.9.3-p385/bin/ruby
Gem files will remain installed in /Users/tobischweiger/.rvm/gems/ruby-1.9.3-p385#diaspora/gems/rmagick-2.13.2 for inspection.
Results logged to /Users/tobischweiger/.rvm/gems/ruby-1.9.3-p385#diaspora/gems/rmagick-2.13.2/ext/RMagick/gem_make.out
I'm not very experienced with gem and homebrew and I'm wondering if somebody could help me out.
Run this (using homebrew) before attempting to install the gem.
brew install imagemagick
This is the less destructive version using homebrew, rmagic also doesn't work with imagemacigk version 7
ImageMagick Version 6.4.9 or later (6.×.x). Version 7 is NOT yet
supported; ETA April 2019 (https://github.com/rmagick/rmagick/pull/299 )
(from Readme)
. You can get ImageMagick from www.imagemagick.org., so with brew try this
brew install imagemagick#6
PKG_CONFIG_PATH=/usr/local/opt/imagemagick#6/lib/pkgconfig gem install rmagick
I'm using OS X Lion.
I ran brew doctor and saw that imagemagick was unlinked so it told me to run brew link imagemagick.
Then I closed and re-opened my terminal and everything worked thankfully.
On Mavericks, you can do it:
brew install pkgconfig
brew uninstall imagemagick
brew install imagemagick
brew link imagemagick
bundle install
It's enough. I think.
I had a similar issue and this worked for me:
$ cd /usr/local/Cellar/imagemagick/6.8.0-10/lib
$ ln -s libMagick++-Q16.7.dylib libMagick++.dylib
$ ln -s libMagickCore-Q16.7.dylib libMagickCore.dylib
$ ln -s libMagickWand-Q16.7.dylib libMagickWand.dylib
Hope this helps.
Credit: https://coderwall.com/p/wnomjg
Make sure when you do these:
$ cd /usr/local/Cellar/imagemagick/6.8.0-10/lib
$ ln -s libMagick++-Q16.7.dylib libMagick++.dylib
$ ln -s libMagickCore-Q16.7.dylib libMagickCore.dylib
$ ln -s libMagickWand-Q16.7.dylib libMagickWand.dylib
that you change the file names to reflect your version: you can see the filenames by looking in the lib folder here: cd /usr/local/Cellar/imagemagick/VERSION/lib
ex:
ln -s libMagickWand-6.Q16.1.dylib libMagickWand.dylib
and so on
There are different scenarios we need to check while installing RMagick. Please check following and confirm:
Check if you are not installing latest version of RMagick with older version of ruby. i.e. ruby 1.8.7 or so. You can not install latest version of RMagick with older version of Ruby. If so, you will probably get this error message.
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/user/.rbenv/versions/1.8.7-p375/bin/ruby extconf.rb
Make sure you have installed imagemagick before you install RMagick.
brew install imagemagick
Also make sure you are installing RMagick with compatible version of imagemagick. RMagick is not compatible with latest version of imagemagick.
More to this:
instead of using RMagick you can use MiniMagick if you just need to resize, sharpen, transform existing images. RMagick is required when we need to create image, graphs, drawings and typography. It’s easier to work with and much lighter on system resources than RMagick. RMagick consumes huge amount of memory.
The main issue seems to be getting imagemagick properly installed and linked.
This page was very helpful for me:
http://sethvargo.com/20110726/install-imagemagick-on-mountain-lion/
I'm running homebrew, and getting the brew doctor command to run clean was the key to getting this to install.
I found that updating my Xcode to the latest version (4.6.1) on OSX 1.8.2 fixed this problem and I Successfully installed rmagick-2.13.2
For me, I had to look at the output which in your case is
/Users/tobischweiger/.rvm/gems/ruby-1.9.3-p385#diaspora/gems/rmagick-2.13.2/ext/RMagick
In there is a file called mkmf.log that lists exactly what it is trying to compile and the error. For me, the linker was failing with this command:
ld: library not found for -lMagickCore
Reviewing the command it was running it looked good except for the very end, see this snippet:
-lMagickCore-6.Q16 -lMagickCore-6.Q16 -lruby-static -framework CoreFoundation -lMagickCore -lpthread -ldl -lobjc -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/lib/darwin/libclang_rt.osx.a
Note that it got the output from Magick-config and used those by adding -lMagickCore-6.Q16 but it was still trying to link -lMagickCore. I think this is a byproduct of the have_library extconf is using. Important for me, was that there was no libMagickCore.dylib library provided by Homebrew. It could be an old version of rubygems and I think the correct fix would be to update the have_library function but I fixed it by making a symlink called libMagickCore.dylib that pointed to libMagickCore-6.Q16.dylib.

Installing RMagick gem -- Can't find MagickWand.h

I am installing the rmagick gem on OSX 10.6.8, using gem install rmagick, and I am getting the following error
Can't install RMagick 2.13.1. Can't find MagickWand.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/disaacs/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
Gem files will remain installed in /Users/disaacs/.rvm/gems/ruby-1.9.3-p125/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/disaacs/.rvm/gems/ruby-1.9.3-p125/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
Looking in the mkmf.log file I see
have_header: checking for wand/MagickWand.h... -------------------- no
"/usr/bin/gcc-4.2 -E -I/Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/x86_64-darwin10.8.0 -I/Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby/backward -I/Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1 -I. conftest.c -o conftest.i"
conftest.c:3:29: error: wand/MagickWand.h: No such file or directory
It's true. The file MagickWand.h is not found in any of the directories specific by the -I directives of the gcc-4.2 command. Why not? And how can I fix this?
ImageMagick is installed, using homebrew. If I search my drive I find MagicWand.h installed in /usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/wand/MagickWand.h.
I've tried all the suggestions in Can't install RMagick 2.13.1. Can't find MagickWand.h., but none of them have worked.
Edit:
Another thing to note: I originally had ImagMagick 6.7.0-7 installed using MacPorts, and RMagick installed just fine. Except that it would not work with the CarrierWave gem. So I uninstalled MacPorts and uninstalled RMagick. Then reinstalled ImageMagick using brew install -f imagemagick --disable-openmp, and attempted to reinstall the rmagick gem (which brings me to my current problem). I restarted all terminals at each step, to ensure that my paths were refreshed.
For Debian-based (e.g., Ubuntu) systems you can try,
sudo apt-get install libmagickcore-dev libmagickwand-dev
gem install rmagick
it works for me.
found solution from ruby-forum
1) install by installer
http://cactuslab.com/imagemagick/
2) try gem install rmagick
if checking for wand/MagickWand.h... no
type
mdfind MagickWand.h
find some thing like
/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/wand/MagickWand.h
and type in terminal
C_INCLUDE_PATH=/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/ gem install rmagick
if, after that you have this error (because a had it) "Package MagickCore was not found in the pkg-config search path."
type
mdfind MagickCore.pc
find some thing like /opt/ImageMagick/lib/pkgconfig/MagickCore.pc
and finally in terminal type:
PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install rmagick
Turns out the answer was in Can't install RMagick 2.13.1. Can't find MagickWand.h. after all. I had just followed the suggestion incorrectly.
C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick gem install rmagick
This installed rmagick gem successfully.
Unfortunately, rmagic is still not working with CarrierWave :-(, but that is a different problem altogether.
Here's a solution for OS X Mavericks - at least it worked for me...
First, install Xcode 5 (from the App Store)
Then install development-tools - open Terminal and type:
xcode-select install
Next, grab the ImageMagick package from CatusLab: http://cactuslab.com/imagemagick/
(I opted for the package without Freetype support, that requires XQuarz - but it's really up to you).
You'll need pgkconfg as well - get it here: http://macpkg.sourceforge.net
Once installed, export the pkgconfig binary:
export PATH=/opt/pkgconfig/bin:$PATH
Then find the MagickWand.h
mdfind MagickWand.h
it puts out the path to MagickWand.h, in my case /opt/ImageMagick/include/ImageMagick-6/wand/MagickWand.h
Next find the pkgconfig path:
mdfind MagickCore.pc
For me it put out: /opt/ImageMagick/lib/pkgconfig/MagickCore.pc
I had the problem that rmagick gem couldn't be fetched so I downloaded it from rubygems.org/gems/rmagick
With the rmagick gem downloaded to your Download folder you should now be able to install rmagick:
sudo C_INCLUDE_PATH=/opt/ImageMagick/include/ImageMagick-6/ PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install --local ~/Downloads/rmagick-2.13.2
For me it installed successfully - hope this helps...
I wasted a lot of time on this, ImageMagick versions above 6.7 don't play nicely with the installation of the rmagick gem. It looks like someone made a package to address this issue, try:
brew install imagemagick-ruby186
After uninstalling your previous imagemagick. Afterwards gem install rmagick worked fine for me.
I am on OS X El Capitan.
My app is using ruby 2.1.2 and rmagick 2.13.4.
When using brew install imagemagick I get ImageMagick -v 7.0.4-5.
The solution for me was to use brew install imagemagick#6 which gave me ImageMagick -v 6.9.7-5 which allowed me to successfully install the gem.
here's what i did on 16.04.1,
sudo apt-get install libmagickwand-dev
sudo apt-get install graphicsmagick-imagemagick-compat
and then install gem
PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH" gem install rmagick -v '2.13.2'
I had a similar issue with running
$ gem install rmagick
then check the version by typing
$ convert --version
If you do, you probably either installed it with fink or macports (maybe homebrew?). What is happening is that rvm can't find the imagemagick directory.
After reading https://superuser.com/questions/361435/i-have-compiled-imagemagick-on-my-centos-and-rmagick-wont-install I exported the imagemagick path by adding
$ export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:$PKG_CONFIG_PATH"
to my ~/.bash_profile, sourcing the new profile, then running gem install rmagick again.
this worked for me try
if the above solution doesnt work then try following command
sudo apt-get install libmagickwand-dev
this will help i hope.
The only thing that worked for me on OSX El Capitan (10.11.6) was cloning this repository:
https://github.com/zagros/imagemagick-rmagic-el-captian
And following compile steps for each library described on that github page, but with slight modification.
The imagemagick itself in stuff folder is already compiled and lacks configure script, so I took other image magick from stuff sierra extracted it and compiled, installed and after that gem install rmagick worked.

sqlite3-ruby install error on Ubuntu

I have the following error during sqlite3-ruby install:
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal' or 'yum install sqlite3-devel'
*** 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/bin/ruby1.8
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.1/ext/sqlite3/gem_make.out
sqlite3.h is located in /usr/include/
sudo gem install sqlite3-ruby --without-sqlite3-include=/usr/include
doesn't work
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --without-sqlite3-include=/usr/include
Ubuntu 10.04
You need the SQLite3 development headers for the gem’s native extension to compile against. You can install them by running (possibly with sudo):
apt-get install libsqlite3-dev
You just need a -- in there.
sudo gem install sqlite3-ruby -- --with-sqlite3-include=/usr/include
That specifies that the option is not to gem directly, but the specific gem.
In my case I have no basic compilers installed, so
sudo apt-get install build-essential
solved my problem, but for most the people I think https://stackoverflow.com/a/3649005/417267 is the solution.
This is what I did:
wget http://www.sqlite.org/sqlite-amalgamation-3.7.2.tar.gz
tar xzf sqlite-amalgamation-3.7.2.tar.gz
cd sqlite-3.7.2/
./configure
make
make install
gem install rails sqlite3-ruby
from : http://cuasan.wordpress.com/2010/10/13/rails-3-on-debian-with-sqlite-3/
If you run in ubuntu,and using RVM for ruby on rails,please add FIRST:
sudo apt-get install libxslt-dev libxml2-dev
OR You can check with these commands:
This command will prepare for you two packages : sqllite3 and libsqlite3-dev
sudo apt-get install sqlite3
libsqlite3-dev
-Now,install sqlite gem
[sudo] gem install sqlite3-ruby
-using Ubuntu doesn't need sudo.
Goodluck! Note: i'm using Ubuntu 10.10 and it's working.
This was simply enough to make it work
sudo apt-get install libsqlite3-dev
Thanks to marshluca
Tried ALL of other solutions, none helped.
It turned out that you also need dev package for ruby itself. For me, it helped
sudo apt-get install ruby-full
It has a lot of nasty dependencies though (like emacs, wtf?), just
sudo apt-get install ruby1.8-dev
should be fine. After it's installed (and you have the sqlite and sqlite-dev packages installed)
sudo gem install sqlite3-ruby
works like a charm.
From sqlite3-ruby gem can't find sqlite3.h on ubuntu:
You also need to install gcc itself, so in total it would be:
sudo apt-get install gcc libsqlite3-dev ruby1.8-dev
sudo gem install sqlite3
Apparently you get a wrong error pointing to a missing sqlite3.h when the actual problem is missing gcc itself.
Here's a better answer from HEROKU - cannot run git push heroku master
Since you can't use sqlite3 on heroku add this to your Gemfile:
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end
The solution is to add -- to separate configure parameters from gem parameters.
instead of
sudo gem install sqlite3-ruby --without-sqlite3-include=/usr/include
try this, all on one line, make sure to include -- after the last gem parameter and before configure parameters:
sudo gem install sqlite3 --
--with-sqlite3-lib=/somewhere/local/lib
--with-sqlite3-include=/somewhere/local/include
This should get you around this error:
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --without-sqlite3-include=/usr/include
Had this same problem and the following worked for me:
compile sqlite3 as static library, install somewhere in your home directory and then provide that option for the gem install process.
Go to the download page and grab the source. Most recent version at this time is http://www.sqlite.org/sqlite-autoconf-3070400.tar.gz
tar -xf on the file or do whatever you normally do to uncompress; enter directory
./configure --disable-shared --enable-static --prefix=/some/path/in/my/home
compile, install, and when you're installing the gem...
gem install sqlite3-ruby -- --with-sqlite3-dir=/some/path/in/my/home
None of the above mentioned solution worked for me, even after installing ruby2.5-dev and libsqlite3-dev. Then tried using PostgreSql instead of sqlite. That worked fine. To use PostgreSql instead of sqlite use this command when creating rails project.
rails [_VERSION_] new project_name -d postgresql
If you want to use MySql then use mysql instead of postgresql.
rails [_VERSION_] new project_name -d mysql
Else you can try without sqlite.
bundle install --without sqlite
Not --without-sqlite3-include=/usr/include, but --with-sqlite3-include=/usr/include.
This is the exact same problem I had a few weeks ago. I found out I needed to download the most recent headers/libraries from the SQLite Download Page. Try it out, hope this helps!
For me the problem was solved by getting mkmf, which is in ruby1.8-dev.
sudo apt-get install ruby1.8-dev
Thanks to mentalized for that one.
I agree with Danya Vershinin & EnotionZ.
If can't use apt-get:
compile & install sqlite3 from sources by specifying your own "prefix" path.
More information can be found in the README.
Then passed this path to the sqlite3-ruby installer (don't forget the "--").
You have broken version of RVM. Ubuntu does something to RVM that produces lots of errors, the only safe way of fixing for now is to: sudo apt-get --purge remove ruby-rvm sudo rm -rf /usr/share/ruby … , if it does not help then restart your computer. install RVM: \curl -L https://get.rvm.io | bash -s stable --ruby --autolibs=enable --auto-dotfiles If you find you need some hand-holding, take a look at Installing Ruby on Ubuntu 12.04, which gives a bit more explanat
Forget everything and do this,
run
yum install ruby-devel sqlite sqlite-devel ruby-rdoc
yum install make gcc
gem install sqlite3-ruby
bundle install
That's for rhel, run same for ubuntu.
I just downgraded to sqlite3-ruby '1.2.2'

Resources