I am working on a gem and am trying to write to the /etc/hosts file however permission is denied as a normal user. Trying to do it via sudo appname patch_hostfile results in the following
.rvm/rubies/ruby-2.6.2/lib/ruby/site_ruby/2.6.0/rubygems.rb:284:in `find_spec_for_exe': can't find gem appname (>= 0.a) with executable vcdm (Gem::GemNotFoundException)
I think it is doing this because rake install only installs for the current user but sudo should have access to everything so I'm not sure if that is the problem.
Related
I am trying to install Metasploit and one of the steps is to run the bundle install command. I am doing this on terminal on mac osx. But when ever I try to do this, this happens:
Errno::EACCES: Permission denied # rb_sysopen -
/Users/soldenh/.rvm/gems/ruby-2.4.0/cache/metasploit-payloads-1.2.6.gem
An error occurred while installing metasploit-payloads (1.2.6), and
Bundler cannot continue.
Make sure that `gem install metasploit-payloads -v '1.2.6'` succeeds before
bundling.
When I run a ./msfconsole it says:
Your bundle is locked to activesupport (4.2.7.1), but that version
could not be found in any of the sources listed in your Gemfile. If
you haven't changed sources, that means the author of activesupport
(4.2.7.1) has removed it. You'll need to update your bundle to a
different version of activesupport (4.2.7.1) that hasn't been removed
in order to install.
How do I fix this???
Like it suggested, run
gem install metasploit-payloads -v '1.2.6'
I dont have admit rights in ssh machine so i could not install any gem
gem install json
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /var/lib/gems/1.9.1 directory.
is there any ways to install it without admin rights?
gem install --user-install json
This will attempt to install the gem into ~/.gem/[some subdirectory], which you should be able to write to. (By default gem is trying to write to /var, which you don't have permission to write as a non-admin.)
Note that you will have to append the location the gem is installed to to your PATH variable to use it (on install you should get a warning to that effect). See this blog post about --user-install for more info
I am supposed to install ruby labs on my computer and the instructions given to me are found here: http://ix.cs.uoregon.edu/~conery/eic/software.html
However, I'm facing problems downloading the ruby labs gem. The command given was:
gem install --user-install rubylabs -n .
I keep receiving these errors:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Users/Admin/.gem/ruby/1.8 directory.
I then did sudo gem install --user-install rubylabs -n .
But i got this error instead:
Successfully installed rubylabs-0.9.8
Installing ri documentation for rubylabs-0.9.8
/Users/Admin/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/rdoc/rdoc.rb:280: warning: conflicting chdir during another chdir block
/Users/Admin/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/rdoc/rdoc.rb:287: warning: conflicting chdir during another chdir block
Furthermore, after proceeding on with ruby lab-setup.rb, when I type irb, i receive this error as well: no such file to load -- rubylabs
===============================
Apparently it was my RVM that was causing the problem and deleting it solved the above problem. However, I would like to understand why RVM cause those issues.
Could someone please help? I'm at my wits end.
Thanks
I just had this issue as well:
no such file to load -- rubylabs
ruby lab-setup.rb basically adds lines to require rubygems and rubylabs on each new IRB session. The above no such file to load basically meant that rubylabs is not installed locally in rvm. A gem list command would reveal something like the following:
MBA:~ user$ gem list
*** LOCAL GEMS ***
gem-wrappers (1.2.4)
rvm (1.11.3.9)
I am new to Ruby as well... So what I did was basically just run the following command to install rubylabs:
gem install rubylabs -n .
A gem list would reveal it as installed:
*** LOCAL GEMS ***
gem-wrappers (1.2.4)
rake (10.1.1)
rubygems-test (0.4.3)
rubylabs (0.9.8)
rvm (1.11.3.9)
IRB will now run normally.
I have been trying to install and run rubyonrails in my macbook Snow Leoppard 10.6.8, with Ruby 1.9.2-p290.
When I write bundle install im having this problem, not just with Postgres also with SQLite and MySQL.
Installing pg (0.11.0) /Users/felipevelasquez/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:585:in initialize': Permission denied -/Users/felipevelasquez/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.11.0/Rakefile` (Errno::EACCES)
When I write sudo bundle install I have this:
/Users/felipevelasquez/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [mime-types-1.16, minitest-1.6.0, rack-1.3.2, rake-0.8.7, rdoc-2.5.8, rest-client-1.6.7, sequel-3.20.0, sinatra-1.0, sqlite3-1.3.4, sqlite3-ruby-1.3.3, taps-0.3.23] (Gem::LoadError)
Cause of this problem is this: this could be a rvm bug, I have experienced too earlier.
the directory to write has no permission, while you escalating the privilege, the gem env and PATH info is not passed into it.
You can either try to install rvm and ruby. OR export your env and path with sudo command. for example:
sudo export GEM_HOME = /path/to/gem_home && bundle install
I am new to programming and trying to understand this error. The error is really strange because I have already installed the heroku gem (using sudo and not using sudo). I am using OS X.
skline-mac:~ skline$ sudo heroku keys:add
/Users/skline/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:861:in `report_activate_error': Could not find RubyGem heroku (>= 0) (Gem::LoadError)
from /Users/skline/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:255:in `activate'
from /Users/skline/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:1204:in `gem'
from /Users/skline/.rvm/gems/ruby-1.9.2-p136#rails3tutorial/bin/heroku:18:in `<main>'
You're using rvm, so there's no need for sudo, either for gem install heroku or using the heroku gem. This should work without any use of sudo:
gem install heroku
heroku keys:add
If this does not work, try resetting the ownership on your .rvm directory to your own user account (because you used sudo at some point in the past):
sudo chown -R $USER:staff ~/.rvm