I have made a script that is already working properly in my development environment with RVM. This script reads *.eml files and parses them.
Now, my problem is this. When I transfer it to the production server, it gives a Permission denied - filename.eml (Errno::EACCES)
when reading some files. When I manually read these files using sudo nano filename.eml
, it is readable so I thought running my ruby script with sudo is the answer.
But when I tried running it with sudo ruby scriptname.rb
, this time it gives me a cannot load such file -- mail (LoadError)
.
The mail gem is clearly installed and is shown both in gem list --local
and sudo gem list --local
.
The ruby versions are identical with or without sudo (1.9.3).
The mail gem is also accessible using sudo irb
then typing require 'mail'
.
Both development and production environments are on a Mac OS with RVM-managed ruby versions.
Any help will be greatly appreciated. Thanks.