How to install ImageMagick for use with RVM - ruby-on-rails-3

I had a non-rvm app going and decided to move to RVM. Now I'm noticing paperclip failing as ImageMagick isn't available.
[paperclip] An error was received while processing: #<Paperclip::CommandNotFoundError: Could not run the `identify` command. Please install ImageMagick.>
What's the right way to get ImageMagick installed on RVM?

On OS X if you have brew installed, you can simply use the following command:
brew install imagemagick

ImageMagick isn't a gem, it's a normal packet. On debian, the package name is imagemagick. You can install it via apt-get install imagemagick as root.

None of the above worked (on Ubuntu 10.10 64 bit)
I had to
sudo apt-get install imagemagick
sudo apt-get install libmagickcore-dev libmagickwand-dev
then
gem install rmagick
(in Rails 3.1)

On ubuntu, but this might also work on MacOS. You def want to compile from source when using ruby. Here the script I use
*install_imagemagick.sh*
#!/bin/bash
mkdir -p ~/local
command -v identify > /dev/null
if [ $? -eq 1 ]; then
echo "${bldgrn}Installing imagemagick into ${txtwht}$HOME/local/imagemagick${txtrst}"
wget -N --retr-symlinks ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar -xzvf ImageMagick.tar.gz
cd ImageMagick-*
./configure --prefix=$HOME/local/imagemagick
make
make install
cd ..
rm -rf ImageMagick-*
fi
Then I add this to my ~/.bashrc or ~/.zshrc
export PATH=$HOME/local/imagemagick/bin:$PATH
export LD_LIBRARY_PATH=$HOME/local/imagemagick/lib:$LD_LIBRARY_PATH
Then you can install your ruby bindings if necessary:
gem install rmagick

For Cygwin, remember to use:
http://www.imagemagick.org/download/binaries/ImageMagick-i686-pc-cygwin.tar.gz
instead of:
http://cygwin.com/packages/ImageMagick/

If you are on Ubuntu, you can install the package using:
apt-get install imagemagick

Related

Can't install ruby 2.6.6 via rvm, error running '__rvm_make -10' on macbook pro m1

While installing the ruby 2.6.6 I'm getting this error:
Error running '__rvm_make -10'
please read /home/.rvm/log/1642694273_ruby-2.6.6/make.log
There has been an error while running make. Halting the installation.
I've tried to reinstall rvm but this changes nothing.
Other ruby versions are installed just fine.
rvm install 2.6.6 --with-out-ext=fiddle worked for me
downgrade libssl-dev with:
sudo apt install libssl-dev=1.1.1l-1ubuntu1.4
check the solution in this issue: https://github.com/rvm/rvm/issues/5209#issuecomment-1134927685
Right click Terminal from the Application/Utilities folder, Get Info, tick the "Open using Rosetta" box.
Uninstall Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
rm -rf /opt/homebrew/*
sudo rm -rf /opt/homebrew
Reinstall Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Restart terminal
Check Homebrew is working fine: brew doctor
Reinstall openssl: brew install openssl
Install Ruby: rvm install 2.5.3 Or any version
In case this helps anyone, none of the posted solutions worked on my intel MacBook Pro. brew doctor however did warn my developer tools were out of date. Uninstalling and reinstalling those allowed me to return to using RVM as normal:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

sudo: pecl7.2-sp: command not found

I need to install GeoIP on PHP 7.2 .
For this I am using following commands -
sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install libgeoip-dev
sudo pecl7.2-sp install geoip-beta
Top two commands are run successfully, But while running the third on I am getting following error -
sudo: pecl7.2-sp: command not found
Any suggestion, How can I install pecl on php 7.2 or any other way to install GeoIP on php 7.2.
I am on ubuntu 16:04 and the following got it working for me (more or less):
Run the following command:
sudo apt-get install php-pear php-dev
Now you can run the command pecl instead pecl7.2-sp - seems to work fine though:
sudo pecl install geoip-beta
Hope that helps.
I had to install imagick for php7.3 so I was getting same error using command like this
sudo pecl7.2-sp install imagick
What worked for me is running the command like this
pecl -d php_suffix=7.3 install -f imagick

Phalcon install give error on ubuntu [duplicate]

I'm just finished installing Ubuntu 13.10.
I want try Phalcon, and when I build the source (phalcon.so), I have this error :
from /home/fabrice/Downloads/cphalcon/build/32bits/phalcon.c:204:
/usr/include/php5/ext/pcre/php_pcre.h:29:18: fatal error: pcre.h: No such file or directory
#include "pcre.h"
^
compilation terminated.
make: *** [phalcon.lo] Erreur 1
My installation of lamp is :
sudo apt-get install -y apache2 php5 mysql-server libapache2-mod-php5
php5-mysql php5-curl php5-imagick php5-mcrypt php5-memcache
php5-sqlite php5-xdebug php-apc php5-intl php-mongo php5-dev gcc
Can anybody help me ?
The latest version of Phalcon uses PCRE libraries.
You can install them like so:
sudo apt-get install libpcre3-dev
and then try and install Phalcon again
For CentOS you will need to use
sudo yum install pcre-devel
Credits: #xgretsch
For Mac you can use
brew install pcre
Credits #Brandon Romano
For Mac without brew
Go to https://www.pcre.org/ and download latest pcre:,
tar -xzvf pcre-8.42.tar.gz
cd pcre-8.42
./configure --prefix=/usr/local/pcre-8.42
make
make install
ln -s /usr/local/pcre-8.42 /usr/sbin/pcre
ln -s /usr/local/pcre-8.42/include/pcre.h /usr/include/pcre.h
Credits #user1377324
For mac osx maverick you can use
brew install pcre
if it gives you error, you can use
sudo ln -s /opt/local/include/pcre.h /usr/include/
sudo pecl install apc
I have installed pcre via homebrew in Big Sur, so linked as:
sudo ln -s /opt/homebrew/include/pcre2.h /usr/local/include/
To include pcre.h file, search the package archives for the pcre.h file.
To do this I use a command called apt-file (
apt-get install apt-file
and
apt-file update
if you don’t have it installed).
Then search for the pcre package:
apt-file search -x "/pcre.h$"
The -x informs the command that I want to use a regular expression as the pattern. apt-file provided me with three hits:
kannel-dev: /usr/include/kannel/gwlib/pcre.h
libajax6-dev: /usr/include/ajax/pcre.h
libpcre3-dev: /usr/include/pcre.h
The last one is the one I want:
apt-get install libpcre3-dev
This will solve the problem with pcre.h file compilation problem. Hope it will help others, who may come to find an answer to this thread.
For MacOS monterey amd64 (darwin), it is necessary to create a symlink.
First, locate where the pcre.h was installed by Brew:
$ brew list pcre | grep 'pcre\.h$'
/opt/homebrew/Cellar/pcre/8.45/include/pcre.h
Then, gets the directory that GCC is looking for header (.h) files:
$ cpp -v
...
#include <...> search starts here:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
/Library/Developer/CommandLineTools/usr/include # <---- we are going to use this one
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
Finally, create a symlink to the pcre.h file, so that GCC will find it in its search path:
ln -s /opt/homebrew/Cellar/pcre/8.45/include/pcre.h \
/Library/Developer/CommandLineTools/usr/include/pcre.h
To test if it worked, we can use the following C code:
#include <stdio.h>
#include <pcre.h>
int main() {
printf("lala popo");
return 0;
}
And run:
gcc test.c -o test
πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰
Using macOS Monterey 12.6 on an M1 Pro MacBook Pro, here are the steps necessary to install outh extension for PHP 8.1 using brew:
brew install pcre
brew install pcre2
sudo ln -s /opt/homebrew/include/pcre.h /usr/local/include/
sudo ln -s /opt/homebrew/include/pcre2.h /usr/local/include/
sudo pecl install oauth

gem install pg only works as sudo

I have read a lot on this topic, but seems like nobody has had the exact problem I am having.
I am trying to install Postgres support for Rails 3 on Ubuntu. If I run:
sudo gem install pg
everything works fine.
However, I am using GemFile and trying to deploy my application to Heroku, so doing:
bundle install
As part of the bundle install it fails when doing gem install pg with the following error:
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.9/usr/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /Library/PostgreSQL/9.1/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
Any ideas why this is happening. Surely it would also fail to install as sudo if I do not have the correct libraries installed. Is this some kind of permissions problem?
Thanks for your help in advance,
Olli
I believe you need to install libpq. Please try:
sudo apt-get install libpq-dev
And btw, this may be a helpful hint for you. I usually setup my development environment using this chain (this is valid for Ubuntu 12.04 LTS):
sudo apt-get install libpq-dev build-essential openssl libreadline6 libreadline6-dev curl zlib1g \
zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev \
autoconf libc6-dev ncurses-dev automake libtool bison subversion ncurses-term \
exuberant-ctags libnotify-bin curl autoconf make automake ssh git-core git-doc imagemagick libpq-dev vim \
libreadline5 libmysqlclient-dev imagemagick libmagick+5 \
libmagick++-dev libmagickwand4 libmagickcore4 libmagickcore4-extra libmagickcore-dev \
libmagickwand-dev \
tmux libcurl4-openssl-dev \
libsqlite3-0 libsqlite3-dev sqlite3 postgresql-contrib mysql-server memcached \
gimp chromium-browser chromium-codecs-ffmpeg-extra chromium-browser-inspector \
bind9 terminator libqt4-dev xvfb gitk postgresql pgadmin3 rar unrar\
ubuntu-restricted-extras vlc compizconfig-settings-manager gstreamer0.10-plugins-ugly flashplugin-installer

rmagick gem install "Can't find Magick-config"

I get the error shown below when attempting to install the rmagick gem. I am on Snowleopard 10.6 using RVM, Ruby 1.9.2-head and Rails 3.05. Responses to similar questions recommended installing ImageMagick, which I successfully did. Other suggested installing the "libmagick9-dev library", however, I can not figure out how to do this.
I'm a new developer, and any assistance or directions to an existing explanation or resource is greatly appreciated. Thanks!
jjdevenuta(opal)$ 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/jjdevenuta/.rvm/rubies/ruby-1.9.2-head/bin/ruby extconf.rb
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 /Users/jjdevenuta/.rvm/gems/ruby-1.9.2-head#rails3/bin:/Users/jjdevenuta/.rvm/gems/ruby-1.9.2-head#global/bin:/Users/jjdevenuta/.rvm/rubies/ruby-1.9.2-head/bin:/Users/jjdevenuta/.rvm/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/X11/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/jjdevenuta/.rvm/rubies/ruby-1.9.2-head/bin/ruby
UPDATE
If you're a Mac/OS X user I would HIGHLY recommend using Homebrew as your package installer/manager. You can find it HERE. Since originally asking this question I have removed all my prior installs of things like rmagick and imagemagick, and reinstalled them using Homebrew. Super easy with a huge catalog of packages, and updates/uninstalls are a cinch as well!
When building native Ruby gems, sometimes you'll get an error containing "ruby extconf.rb". This is often caused by missing development libraries for the gem you're installing, or even Ruby itself.
Do you have apt installed on your machine? If not, I'd recommend installing it, because it's a quick and easy way to get a lot of development libraries.
If you see people suggest installing "libmagick9-dev", that's an apt package that you'd install with:
$ sudo apt-get install libmagickwand-dev imagemagick
or on centOs:
$ yum install ImageMagick-devel
On Mac OS, you can use Homebrew:
$ brew install imagemagick
The new correct way is to install libmagickwand-dev:
sudo apt-get install libmagickwand-dev
Then you should be able to install rmagick no problem.
imagemagick#6 works for me!
brew unlink imagemagick
brew install imagemagick#6 && brew link imagemagick#6 --force
See this thread
Ubuntu 15.10
Note that if you try to install this gem in ubuntu 15.10, then error can happened:
Can't install RMagick 2.13.1. Can't find Magick-config in ...
All you need is preload PATH variable with additional path to ImageMagick lib.
PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH"
then run gem install rmagick
source of solution
UPDATE
If you're a Mac/OS X user I would HIGHLY recommend using Homebrew as your package installer/manager. You can find it HERE. Since originally asking this question I have removed all my prior installs of things like rmagick and imagemagick, and reinstalled them using Homebrew. Super easy with a huge catalog of packages, and updates/uninstalls are a cinch as well!
I finally got it working by utilizing a script for ImageMagick installation on github.
magick-installer ( https://github.com/maddox/magick-installer )
It made a fresh install of ImageMagick, and the RMagick 2.12.2 gem then installed perfectly via bundler.
Thanks to Hulihan Applications for confirming that it was most likely a missing library. I tried the suggestion of using apt-get by installing the package downloader from Fink Project. I ran the following command in terminal, but it couldn't find the libmagick9-dev libary.
$ sudo apt-get install libmagick9-dev
$ Password:
$ Reading Package Lists... Done
$ Building Dependency Tree... Done
$ E: Couldn't find package libmagick9-dev
I need to bone up on my UNIX command line skills. The original copy of ImageMagick that I installed from source is still on the machine, but I don't know where exactly or how to remove it. So much to learn...!
Things change...maybe this will help someone else:
sudo apt-get install libmagick9-dev used to work. But with a later version of imagemagick I needed:
sudo apt-get install graphicsmagick-libmagick-dev-compat libmagickcore-dev libmagickwand-dev
Try
1) apt-get install libmagickwand-dev
2) gem install rmagick
For those who don't want to do the build-from-source approach of the (otherwise excellent installer script by John Maddox, the following worked for me when installing on CentOS 6.2. (Adjust your package manager as necessary).
yum install -y {libwmf,lcms,ghostscript,ImageMagick}{,-devel}
gem install rmagick
Again, this is mainly of interest if you use your distro's package manager and would really prefer to keep it sane.
In some OS you need to use new libraries: libmagick++4 libmagick++-dev
You can use:
sudo apt-get install libmagick++4 libmagick++-dev
Important:
sudo apt-get install libmagick++4 libmagick++-dev
works on linux mint 13 after making updates:
sudo apt-get update
Can't install RMagick 2.13.2. in ubuntu 17.10
My decision
- sudo apt-get purge imagemagick libmagickcore-dev libmagickwand-dev
- sudo apt-get autoremove
- sudo rm /usr/bin/Magick-config
- sudo apt-get install imagemagick libmagickwand-dev
Version is required to correctly specify the path to the configuration
cd /usr/lib/x86_64-linux-gnu
View version ImageMagick, my version ImageMagick - 6.9.7.
cd ImageMagick-6.9.7/
ls
look at the name of the directory bin-q16 or bin-Q16
Creating a link to the config
sudo ln -s
/usr/lib/x86_64-linux-gnu/ImageMagick-version/bin-directory/Magick-config
/usr/bin/Magick-config
Creating for my version ImageMagick
- sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.9.7/bin-q16/Magick-config /usr/bin/Magick-config
- bundle
in ubuntu 15.10
sudo apt-get install graphicsmagick-libmagick-dev-compat
did the trick for me
I had to specify version 6
brew install imagemagick#6
brew link --overwrite --force imagemagick#6
If you get an error similar like:
The following packages have unmet dependencies:
libmagickwand-dev : Depends: libmagickcore4-extra (= 8:6.6.9.7-5ubuntu3.2) but it is not going to be installed
Depends: libmagickcore-dev (= 8:6.6.9.7-5ubuntu3.2) but it is not going to be installed
You might want to start with this package: sudo apt-get install libgvc5
For more details: https://askubuntu.com/a/230958/6506
I ran this issue twice on different machine, first time it was resolved by installing the libmagick9-dev
sudo apt-get install libmagick9-dev
and second time i have to install the following libraries.
sudo apt-get install libmagick++4 libmagick++-dev
On Mac OS X sudo port install ImageMagick turned out to work fine to fix the gem install rmagick problem . I just didn't know that it worked fine because rvm during installation blew away my .bash_profile contents which included MacPort's addition of /opt/local/bin to PATH. I put back /opt/local/bin into PATH in my .bash_profile and then my gem install rmagick then succeeded.
I had this problem when I had already installed ImageMagick with macports. I ran
port contents ImageMagick | grep config
To find where the config file had been stored and then ran
PATH=(insert your path here):${PATH} bundle
to install the gem using bundler. From now on, if you run a command that needs to reference ImageMagick, you can prefix it with that command. For example I had a migration that referenced it, so I ran
PATH=/opt/local/bin/:${PATH} rake db:migrate
opt/local/bin/ is the path where my config file was stored.
What I did to fix the problem on Ubuntu was
$ sudo apt-get install libmagickwand-dev
$ sudo apt-get install ImageMagick
Ubuntu:
sudo apt-get install imagemagick libmagickwand-dev libmagickcore-dev
gem install rmagick
CentOS:
yum remove ImageMagick
gem uninstall rmagick
yum install ImageMagick ImageMagick-devel ImageMagick-last-libs ImageMagick-c++ ImageMagick-c++-devel
gem install rmagick
MacOS:
download and install http://xquartz.macosforge.org/trac/wiki/X112.7.2
after:
brew uninstall imagemagick
brew link xz jpeg freetype
brew install imagemagick
brew link --overwrite imagemagick
gem install rmagick
execute this in terminal
sudo apt-get install libmagickcore-dev libmagickwand-dev
if its not work than
sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/local/bin/Magick-config
for reference
Installing rmagick gem in Ubuntu
sudo aptitude Install Imagemagick and GraphicsMagick(If not aptitude go & install in s/w center)
sudo aptitude Install libmagickcore-dev libmagickwand-dev
gem install rmagick -v 2.13.1
For CentOS 5/6 this is what worked for me
yum remove ImageMagick
yum install tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel
mkdir /root/imagemagick
cd /root/imagemagick
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar xzvf ImageMagick.tar.gz
cd ImageMagick-*
./configure --prefix=/usr/ --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes
make
make install
For 64 bit do this
cd /usr/lib64
ln -s ../lib/libMagickCore.so.3 libMagickCore.so.3
ln -s ../lib/libMagickWand.so.3 libMagickWand.so.3
Add the missing dependencies
yum install ImageMagick-devel
Then finally rmagick
gem install rmagick
If you need to start fresh remove other installs first with
cd /root/imagemagick/ImageMagick-*
make uninstall
On ubuntu, you also have to install imagemagick and libmagickcore-dev like this :
sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev
Everything is written in the doc.
After much digging, I fixed this on debian 8.3 using information here:
https://www.bountysource.com/issues/18142073-can-t-install-gem-on-ubuntu-15-04
Specifically:
sudo apt-get purge graphicsmagick graphicsmagick-dbg imagemagick-common imagemagick imagemagick-6.q16 libmagickcore-6-headers libmagickwand-dev
sudo apt-get autoremove
sudo apt-get install imagemagick libmagickwand-dev
gem install rmagick
Remember to ckeck the archive Gemfile.lock after the instalation.
Remove this archive and execute bundle again.
It works for me in linux :D