# RMagick gem problem using Rails and possibly WEBRick

**URL:** <https://www.ruby-forum.com/t/rmagick-gem-problem-using-rails-and-possibly-webrick/61232>\
**Category:** Rails\
**Created:** [May 22, 2006, 6:36am UTC](https://www.ruby-forum.com/t/rmagick-gem-problem-using-rails-and-possibly-webrick/61232 "2006-05-22T06:36:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![codejoy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/74df32/32.png) [@codejoy](https://www.ruby-forum.com/u/codejoy)\
**Post date:** [May 22, 2006, 6:36am UTC](https://www.ruby-forum.com/t/rmagick-gem-problem-using-rails-and-possibly-webrick/61232/1 "2006-05-22T06:36:40Z")

</div>

Hello, I am new to rails but have been having fun so far. Until now.  
I  
am sure this is just my inexperience but I have the RMagick gem (ruby  
gem  
for using imagemagick manipulation) installed on my machine that I  
would  
like to then use in my rails app. I first installed it and tried it  
out,  
and it didnt do anything for me, took me a while to realize I needed  
the  
windows RUBYOPT rubygems environment variable set. After that, I  
could  
finally call stuff like:

ruby myLittleTestProg.rb

which used a  
require ‘RMagick’  
and it would run fine.

So I think, I tested my little script out, I want to do it on rails  
and  
call it from my web app. I build a skeleton web app, and goto the  
config/environment.rb file and say:  
require ‘RMagick’

adding this line, kills the skeleton app, what ran fine with webrick  
now  
gives me a strange error that I wll post here. (and yes after  
changing the  
environment.rb file I did relaunch the server). I installed the  
flickr  
gem as well, and this runs fine, I can easily say in the  
environment.rbfile:  
require ‘flickr’  
and it works, it is just when I require ‘RMagick’ from that  
environment.rbfile in my rails app it crashes with this error in the  
index.rhtml:

I am looking for any suggestions, cause I am totally lost. Not sure  
why  
the RMagick include runs fine when I just use it from a ruby .rb file,  
but  
when I try to require it from my rails app, it doesnt work…this is  
locally  
using WEBrick (i tried my rails host online, and it seems that the  
require  
RMagick works there, I just need to get it working locally for  
development  
and testing purposes…)

Thanks for anyone with any help or suggestions…

-Shane  
error is as follows when require ‘RMagick’ is added to environment.rb  
of a  
skeleton rails app:

SyntaxError in imagemod#index

Showing _app/views/imagemod/index.rhtml_ where line _#2_ raised:

compile error  
./script/…/config/…/app/views/imagemod/index.rhtml:2: parse error,  
unexpected $, expecting kEND

Extracted source (around line _#2_):

1: \<%= form\_remote\_tag :url = {:action = ‘search’}, :update =  
‘photos’ %  
2: \<fieldset  
3: \<label for=“tags” Tags:\</label  
4: \<%= text\_field\_tag ‘tags’ %

5: \<%= submit\_tag ‘Find’ %

Trace of template inclusion: /app/views/imagemod/index.rhtml

RAILS\_ROOT: ./script/…/config/…  
Application Trace \<[http://localhost:3000/imagemod#](http://localhost:3000/imagemod#) | Framework  
Trace\<[http://localhost:3000/imagemod#](http://localhost:3000/imagemod#) | Full  
Trace \<[http://localhost:3000/imagemod#](http://localhost:3000/imagemod#)

#{RAILS\_ROOT}/app/views/imagemod/index.rhtml:2:in `compile\_template’

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_view/base.rb:305:in  
`compile_and_render_template' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:290:in `render\_template’  
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_view/base.rb:249:in  
`render_file' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:699:in `render\_file’  
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/base.rb:621:in  
`render_with_no_layout' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/layout.rb:243:in `render\_without\_benchmark’  
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/benchmarking.rb:53:in  
`render' C:/InstantRails-1.0/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure’  
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/benchmarking.rb:53:in  
`render' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:913:in `perform\_action\_without\_filters’  
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/filters.rb:368:in  
`perform_action_without_benchmark' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in `perform\_action\_without\_rescue’  
C:/InstantRails-1.0/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in `perform\_action\_without\_rescue’  
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/rescue.rb:82:in  
`perform_action' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in `process\_without\_filters’  
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/filters.rb:377:in  
`process_without_session_management_support' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in `process’  
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in  
`dispatch' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:in `handle\_dispatch’  
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick\_server.rb:81:in  
`service' C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service’  
C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in  
`run' C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start\_thread’  
C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:162:in  
`start_thread' C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start’  
C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start' C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start’  
C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:in `dispatch’  
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59  
C:/InstantRails-1.0/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:21:in  
`require' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require’  
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30  
C:/InstantRails-1.0/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:21:in  
`require' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require’  
script/server:3

#{RAILS\_ROOT}/app/views/imagemod/index.rhtml:2:in `compile_template' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:305:in `compile\_and\_render\_template’  
C:/InstantRails-  
1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_view/base.rb:290:in  
`render_template' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:249:in `render\_file’  
C:/InstantRails-  
1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/base.rb:699:in  
`render_file' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:621:in `render\_with\_no\_layout’

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/layout.rb:243:in  
`render_without_benchmark' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in `render’

C:/InstantRails-1.0/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in `render’  
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-  
1.12.1/lib/action\_controller/base.rb:913:in  
`perform_action_without_filters' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in `perform\_action\_without\_benchmark’

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' C:/InstantRails-1.0/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure’  
C:/InstantRails-  
1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in `perform\_action’

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/base.rb:381:in  
`process_without_filters' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in `process\_without\_session\_management\_support’

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/session\_management.rb:117:in  
`process' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in `dispatch’

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick\_server.rb:115:in  
`handle_dispatch' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:in `service’  
C:/InstantRails-  
1.0/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run’  
C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:173:in  
`start_thread' C:/InstantRails- 1.0/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start\_thread’  
C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start' C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start’  
C:/InstantRails-  
1.0/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start' C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start’  
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick\_server.rb:67:in  
`dispatch’

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59  
C:/InstantRails-1.0/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:21:in  
`require' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activesupport- 1.3.1/lib/active_support/dependencies.rb:147:in `require’  
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30  
C:/InstantRails-1.0/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:21:in  
`require’

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:147:in  
`require’  
script/server:3

Request

_Parameters_: None

Show session dump \<[http://localhost:3000/imagemod#](http://localhost:3000/imagemod#)

* * *

flash: !map:ActionController::Flash::FlashHash {}

Response _Headers_: {“cookie”= [], “Cache-Control”= “no-cache”}

## – -Shane

Sites:  
Photo  
[http://www.thomascustomdigital.com](http://www.thomascustomdigital.com)  
Coding  
[http://www.viciousbytes.com](http://www.viciousbytes.com)  
fun  
[http://www.flickr.com/photos/codejoy](http://www.flickr.com/photos/codejoy)  
blog  
[http://codejoy.blogspot.com](http://codejoy.blogspot.com)

---

<div class="post-metadata">

**Author:** ![codejoy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/74df32/32.png) [@codejoy](https://www.ruby-forum.com/u/codejoy)\
**Post date:** [May 22, 2006, 7:24am UTC](https://www.ruby-forum.com/t/rmagick-gem-problem-using-rails-and-possibly-webrick/61232/2 "2006-05-22T07:24:31Z")

</div>

rmagick does not work with ruby 1.8.4 on windows. Replace any of these  
three  
with something else and it will work.

---

<div class="post-metadata">

**Author:** ![codejoy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/74df32/32.png) [@codejoy](https://www.ruby-forum.com/u/codejoy)\
**Post date:** [May 22, 2006, 10:39am UTC](https://www.ruby-forum.com/t/rmagick-gem-problem-using-rails-and-possibly-webrick/61232/3 "2006-05-22T10:39:15Z")

</div>

correct. i had to downgrade to 1.8.2.

---

<div class="post-metadata">

**Author:** ![codejoy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/74df32/32.png) [@codejoy](https://www.ruby-forum.com/u/codejoy)\
**Post date:** [May 23, 2006, 6:39am UTC](https://www.ruby-forum.com/t/rmagick-gem-problem-using-rails-and-possibly-webrick/61232/4 "2006-05-23T06:39:30Z")

</div>

Sam D. wrote:

> correct. i had to downgrade to 1.8.2.

thanks so much guys, is it easy to downgrade?  
still that new to this im not sure…

---

<div class="post-metadata">

**Author:** ![codejoy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/74df32/32.png) [@codejoy](https://www.ruby-forum.com/u/codejoy)\
**Post date:** [May 23, 2006, 12:52pm UTC](https://www.ruby-forum.com/t/rmagick-gem-problem-using-rails-and-possibly-webrick/61232/5 "2006-05-23T12:52:50Z")

</div>

Windows XP  
ruby 1.8.4 (2005-12-24) [i386-mswin32]  
Rails 1.1.2  
RMagick-win32 (1.9.2)  
WEBrick 1.3.1

File\_column with RMagick works fine for me.  
I just tried it with skeleton app, that had require ‘RMagick’ in  
environment.rb and that worked ok too. Strange…
