0

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.

Noel Llevares
  • 15,018
  • 3
  • 57
  • 81

1 Answers1

0

maybe the gem is not readable for your server user, such as 'wwwroot', so please make sure the file is 775 mode. e.g.

  1. cd $GEM_HOME
  2. sudo chmod 755 -R .

then everything is readable for other group's users.

Siwei
  • 19,858
  • 7
  • 75
  • 95