Permission denied when installing mailcatcher in Vagrant box

(James D) #1

I’m using the Discourse Vagrant dev guide. It says that mailcatcher should already be installed in the box.

[vagrant@precise32:/vagrant (master)]$ mc
mailcatcher: command not found

I get a permission error when I try to install the gem.

[vagrant@precise32:/vagrant (master)]$ gem install mailcatcher
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ dir_s_mkdir - /usr/local/rvm/gems/ruby-2.1.5/gems/eventmachine-1.0.5

Any ideas how to resolve this? Thanks!

(Jens Maier) #2

Be root, run sudo gem install mailcatcher or run gem install --user-install mailcatcher. In the latter case, the binary will be installed in ~/.gem/ruby/2.1.0/bin, so you’ll either have to add that directory to your $PATH1 or run mailcatcher using the full pathname.

1) echo 'export PATH="~/.gem/ruby/2.1.0/bin:$PATH"' >>~/.bash_profile