简体   繁体   English

安装RMagick Gem Rails 3

[英]Installing RMagick Gem Rails 3

Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Could not find gem 'rmagick v 2.13.1 (>= 0) x86-mingw32' in the gems available o
n this machine.

Hi I am getting message when I run bundle install below is my gemsfile 嗨,我在下面运行bundle install时收到消息是我的gemsfile

source 'https://rubygems.org'

gem 'rails', '3.2.6'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'

gem 'carrierwave'
gem 'rmagick v 2.13.1'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
 gem 'sass-rails',    '~> 3.2.3'
gem 'coffee-rails',  '~> 3.2.1'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby

gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
 gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
 # gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

 # To use debugger
# gem 'debugger'

gem 'will_paginate','~> 3.0'

Is there another way to install the the RMagick gem in Rails 3? 还有其他方法可以在Rails 3中安装RMagick gem吗? I installed carrierwave and need to use rmagick with it. 我安装了carrierwave,并需要将其与rmagick一起使用。 Can I use carrierwave without rmagick? 我可以在没有rmagick的情况下使用载波吗?

You need to alter your Gemfile a little bit. 您需要稍微修改一下Gemfile

gem 'rmagick', '2.13.1'

You also need to install imagemagick on your system. 您还需要在系统上安装imagemagick rmagick requires imagemagick rmagick需要imagemagick

You can install via yum , apt-get or whatever package manager your OS uses. 您可以通过yumapt-get或您的操作系统使用的任何软件包管理器进行安装。

One note is that installing imagemagick on OSX is a little tricky. 需要注意的是,在OSX上安装imagemagick有点棘手。 I recommend using homebrew 我建议使用homebrew

brew install -f imagemagick --disable-openmp

The line in your Gemfile should be: Gemfile中的行应为:

gem "rmagick", "~> 2.13.1"

Also, I would recommend using mini_magick instead as it takes less memory when processing: 另外,我建议改用mini_magick因为它在处理时占用更少的内存:

gem "mini_magick", "~> 3.4"

Can I use carrierwave without rmagick? 我可以在没有rmagick的情况下使用载波吗?

Yes, but you will not be able to do image processing (resizing etc.). 是的,但是您将无法进行图像处理(调整大小等)。 Uploading will work just fine. 上传就可以了。

Found a great answer from Stackoverflow. 从Stackoverflow找到了一个很好的答案。 Worked for me. 为我工作。 Can work for you. 可以为您服务。

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

Error installing Rmagick on Mountain Lion 在Mountain Lion上安装Rmagick时出错

gem 'mini_magick', '~> 4.8'

bundle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM