How to install rmagick on Mac OS X Mountain Lion? - ruby-on-rails

I'm trying to install rmagick on Mountain Lion.
I've installed ImageMagick successfully by Homebrew, but I can't install rmagick gem.
My ruby environment is managed by rvm and installed ruby 1.8.6.
I've got an error below when tried to install rmagick.
gem install rmagick -v 2.7.2
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/Macmini/.rvm/rubies/ruby-1.8.6-p420/bin/ruby extconf.rb
checking for Ruby version >= 1.8.2... yes
checking for /usr/bin/gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.3.0... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... no
checking for sys/types.h... no
checking for magick/MagickCore.h... no
Can't install RMagick 2.7.2. Can't find MagickCore.h.
The erros shows that counldn't find MagickCore.h, but I found in /usr/local/Cellar/imagemagick/6.8.6-3/include/ImageMagick-6/magick/MagickCore.h
I guess if I can manage to tell installer this path, it will go well but I've no idea to do it.
I've googled and found similar questions below.
Can't install rmagick in Mountain Lion
"rmagick" gem installation issue
And tried to pass PKG_CONFIG_PATH and C_INCLUDE_PATH before 'gem install' command, and wrote them to ~/.bash_profie, and build ImageMagick from source, but nothing changed.
Does anyone know how to fix it?

Here you'll find the answer. I had the same issue and this solved perfectly!
Rails and OS X: How to install rmagick?
rmagick has a problem working with imagemagick (>= 6.8.0-10) from homebrew.
You can either
update rmagick gem by
bundle update rmagick
or manually symbol link some dylib to make it work:
$ cd "`Magick-config --prefix`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
After that gem install rmagick should work.

Related

ERROR: Can't install RMagick 4.2.6. Can't find ImageMagick with pkg-config, WSL2 Ubuntu

I'm attempting to update a rails project to use rmagick 4.2.6. Running bundle update gives me the error ERROR: Can't install RMagick 4.2.6. Can't find ImageMagick with pkg-config
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/lafe/.rvm/gems/ruby-3.1.0/gems/rmagick-4.2.6/ext/RMagick
/home/lafe/.rvm/rubies/ruby-3.1.0/bin/ruby -I /home/lafe/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0 -r
./siteconf20220831-171-c6yokv.rb extconf.rb
checking for brew... yes
checking for Ruby version >= 2.3.0... yes
checking for pkg-config... yes
ERROR: Can't install RMagick 4.2.6. Can't find ImageMagick with pkg-config
I believe I have imagemagick installed as running convert logo: logo.gif will generate a gif file.
I also believe the library is linked to pkg-config, as running pkg-config --modversion ImageMagick will output 7.1.0
Running echo $PKG_CONFIG_PATH will return nothing, however if I append the path to include the directory of the ImageMagick.pc file, I still end up with the same error
My os is listed as Ubuntu 20.04 LTS on Windows 10 x86_64 in neofetch, and I'm running it through WSL on windows 11

Error installing TinyTDS on OSX 10.6 via gem install tiny_tds

I have been trying to install the TinyTDS gem on a Macbook with OSX 10.6. I was successful in installing Free TDS -- confirmed that it works via:
tsql -H SERVER -p 1433 -U username.
The error I'm getting from gem install tiny_tds is:
Building native extensions. This could take a while...
ERROR: Error installing tiny_tds:
ERROR: Failed to build gem native extension.
/Users/jason/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
checking for sybfront.h... yes
checking for sybdb.h... yes
checking for tdsdbopen() in -lsybdb... no
-----
freetds is missing.
-----
*** 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.
I've tried specifying the TDS lib and include dirs (/usr/local/lib and /usr/local/include) without luck. I've tried reinstalling FreeTDS from source manually as well as via homebrew, but that made no difference.
I've seen a few similar issues posted, but they seem to reference an issue with locating iconv libraries which I appear to be moving beyond.
Any suggestions or references I may have overlooked? Thanks in advance.
Same problem on Ubuntu 14.04 resolved with:
sudo apt-get install freetds-dev
gem install tiny_tds
Log output:
Building native extensions. This could take a while...
/home/david/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /mnt/datapart/david in PATH, mode 040777
Successfully installed tiny_tds-0.6.1
Parsing documentation for tiny_tds-0.6.1
Installing ri documentation for tiny_tds-0.6.1
Done installing documentation for tiny_tds after 0 seconds
1 gem installed
You need to install freetds with homebrew
brew update # always a good idea to update homebrew before installing anything!
brew install freetds
In my case, it seems the symlinks were not configured correctly, and using "brew link freetds" threw errors which required opening up some permissions. I tried just about everything else, and this is finally what worked:
devMac:0.95.18 Me$ sudo chown -R $USER /usr/local/share/doc/freetds/images
devMac:0.95.18 Me$ sudo chown -R $USER /usr/local/share/doc/freetds/reference
devMac:0.95.18 Me$ sudo chown -R $USER /usr/local/share/doc/freetds/userguide
devMac:0.95.18 Me$ sudo chown -R $USER /usr/local/share/man/man5
devMac:0.95.18 Me$ brew link --overwrite freetds
Linking /usr/local/Cellar/freetds/0.95.18... 2812 symlinks created
devMac:0.95.18 Me$ sudo gem install tiny_tds
Building native extensions. This could take a while...
Successfully installed tiny_tds-0.6.2
Parsing documentation for tiny_tds-0.6.2
Installing ri documentation for tiny_tds-0.6.2
Done installing documentation for tiny_tds after 0 seconds
1 gem installed
Disclaimer: I am in the early stages of learning this framework and do not have an understanding of the repercussions of using overwrite or changing these permissions.
In my case, installing Ruby 2.3.0 using brew install ruby worked. I got the idea from this question Cannot install tiny_tds on os.x 10.9.4.

RMagick install error

all! I have a problem when installing rmagick gem on CentOS 5.5 server. When I issued command:
gem install rmagick
I got:
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.13.1. Can't find Magick-config in /usr/bin:/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.
I have installed imagemagick with correct version, and I find Magick-config in /usr/local/bin and my PATH includes that dir. However, the rmagick gem installer just does not search that dir for Magick-config. What should I do?
By the way, I have another CentOS 5 machine installing ruby and rmagick successfully, and the latter has the Magick-config file in /usr/local/bin, too.
did you installed Imagemagick? eg:
yum install gcc gcc-c++ ImageMagick-devel ghostscript freetype-devel \
libjpeg-devel libpng-devel libpng10-devel libwmf-devel libexif-devel \
libtiff-devel
See this brilliant post on how to fix it. Just skip the last 3 lines as they are PHP related.
http://codercake.com/installing-imagemagick-6-6-9-7-and-imagick-for-php-on-centos-5-5-64-bit/#comment-39
here the commend which I was used in my command prompt. Please check the version
gem install rmagick -v '2.13.1' --platform=ruby -- --with-opt-lib=C:/ImageMagick-6.8.7-Q8/lib --with-opt-include=C:/ImageMagick-6.8.7-Q8/include
On Mac High Sierra - 10.13.4 - https://www.imagemagick.org/script/download.php
sudo port install ImageMagick
sudo gem install rmagick

Installing ImagMagick and rmagick gem in CentOS

I know this has been asked several times, but the problem is they bring in new versions of rmagick and the older methods are not applicable now.
Server - CentOS release 5.6 (Final)
Ruby - ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-linux]
Rails - 2.3.5
I tried to install rmagick gem through these steps. I was root user when I executed these queries:
yum install ImageMagick.i386
yum install ImageMagick-c++-devel.i386
gem install rmagick
The first 2 commands executed smoothly without any errors. On gem install rmagick, I am getting this error:
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
Warning: Found a partial ImageMagick installation. Your operating system likely has some built-in ImageMagick libraries but not all of ImageMagick. This will most likely cause problems at both compile and runtime.
Found partial installation at: /usr
checking for ImageMagick version >= 6.4.9... no
Can't install RMagick 2.13.1. You must have ImageMagick 6.4.9 or later.
My question is how can I install a version > 6.4.9 of ImageMagick. Isnt yum install supposed to install latest version of ImageMagick? or should I try an older version of rmagickgem? In that case, does any one know the older version numbers of rmagick gem?
The version of ImageMagick in the CentOS yum repo is outdated. This kind person has provided updated packages: Problem installing RMagick rubygem on Centos 5
you must be root. just run
yum -y install ImageMagick-perl

Why do I get a bcrypt-ruby gem install error?

Getting an error when trying to install the gem devise, the installation is stopping on
the gem bcrypt-ruby:
$ gem install bcrypt-ruby
Error installing bcrypt-ruby:
ERROR: Failed to build gem native extension.
I'm running OSX 10.6.7 with Ruby under RVM.
I reinstalled the lastest version of xcode & reinstalled Ruby 64bit, Rails and all the gems.
I had the same problem installing under OSX 10.7.3. When installing the gem, my error message was:
Building native extensions. This could take a while...
ERROR: Error installing bcrypt-ruby:
ERROR: Failed to build gem native extension.
creating Makefile
make
compiling bcrypt_ext.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [bcrypt_ext.o] Error 1
Looks like the gem is looking for gcc-4.2 but I only had a file called gcc. Now since I had just installed the latest Xcode (4.3), I knew that my C compiler was compliant but the gem had gcc-4.2 hardcoded into it. So my solution was:
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
The linking worked like a charm.
Looks like there might be some info missing here - for me, this was due to a brew install of gcc. gcc was in /usr/bin, but not gcc-4.2. So I just did the following:
$ cd /usr/bin
$ sudo ln -s gcc gcc-4.2
which creates a link, gcc-4.2, which the gem is looking for that goes back to gcc.
Hope that helps.
It requires to install ruby-dev before installing bcrypt-ruby.
If you are using Ubuntu, run
sudo apt-get install ruby1.9.1-dev
or
sudo apt-get install ruby1.8-dev
based on RUby version.
I'm using RVM & I kept having this issue whenever installing gems with native extensions (bcrypt-ruby, bson-ext, json, eventmachine, nokogiri, linecache19, etc.)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
Only way I could finally get things working was to uninstall then re-install ruby.
rvm remove 1.9.2
rvm install 1.9.2
Thanks to tip from #doublebee here:
https://github.com/flori/json/issues/78#issuecomment-1499920
You only need use rvm (ruby version manager)
rvm uninstall 1.9.3
and then
rvm install 1.9.3
looks this error is on build of rvm 1.9.3, but uninstall and reinstalling fix the problem with bcrypt-ruby 3.0.1
sudo apt-get install ruby1.9.1-dev
whoked charm for me! Thanks a lot
Well, it works with Ruby 1.9.2 under RVM on MacOS 10.6.7:
$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0]
$ gem install bcrypt-ruby
Fetching: bcrypt-ruby-2.1.4.gem (100%)
Building native extensions. This could take a while...
Successfully installed bcrypt-ruby-2.1.4
1 gem installed
Installing ri documentation for bcrypt-ruby-2.1.4...
Installing RDoc documentation for bcrypt-ruby-2.1.4...
Try rvm notes and see if it says you need to install anything.
If you are using version 1.8 the required packages for bcrypt are in the dev bundle. Try using
$sudo apt-get install ruby1.8-dev
then
$gem install bcrypt-ruby
This fix work for me on ubuntu on osx use homebrew, macports whatever:
sudo apt-get install ruby1.9.1-dev
I think you need to reinstall bundler gem.
gem install bundler
and then
bundle install

Resources