I somehow messed my $PATH up. (changed it) and my ruby and rails gems weren’t working. What I did in efforts to fix this was to reinstall RVM. Now my ruby works fine in the Terminal.
On running gem install rails
I get greeted with this:
Permission denied - /Users/emKaro/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.13/test/test_atomic.rb
When I try to install rails through sudo gem install rails
, I get this error:
ERROR: While executing gem … (Errno::EACCES)
I have XCode installed with Command-Line tools installed as well. Even went ahead to install GCC but get the very same error when I try to install rails.
This is the full error message
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Users/emKaro/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.13/test/test_atomic.rb
emmanuels-imac:~ siaW$ sudo gem install rails
Password:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/
/Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0'
from /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:817:in `try_run'
from extconf.rb:24:in `<main>'
Gem files will remain installed in /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.13 for inspection.
Results logged to /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.13/ext/gem_make.out
I am the admin of my computer and running Mac OS 10.8.3. I’d appreciate some help with the rails install.
EDIT:
Thanks @Christoph
The only code that helped was to actually remove the RVM folder with
sudo rm -rf ~/.rvm/
I tried only to uninstal and it didn’t work. So removing the folder and then reinstalling RVM does the job.
I get this error while executing vagrant up following the install instruction from the documentation
`==> Vaprobash: >>> Start installing Ruby Gems
==> Vaprobash: ERROR: While executing gem … (Errno::EACCES)
==> Vaprobash: Permission denied — /var/lib/gems
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell «latest» «sass» «compass»`
Is this from installing rvm.sh
shell script or something else that depending on Ruby?
yes, here is the full log
==> Vaprobash: /tmp/vagrant-shell: line 48: /home/vagrant/.rvm/scripts/rvm: No such file or directory
==> Vaprobash: >>> Start installing Ruby Gems
==> Vaprobash: ERROR: While executing gem … (Errno::EACCES)
==> Vaprobash: Permission denied — /var/lib/gems
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell «latest» «sass» «compass»
switching from 1.4.1 to master
I got the same problem. Vagrant is running on Mac
/tmp/vagrant-shell: line 48: /home/vagrant/.rvm/scripts/rvm: No such file or directory
==> Vaprobash: ERROR: While executing gem ... (Errno::EACCES)
==> Vaprobash: Permission denied @ dir_s_mkdir - /var/lib/gems
The SSH command responded with a non-zero exit status.
==> : >>> Start installing Ruby Gems
==> : Successfully installed sass-3.4.13
==> : Building native extensions. This could take a while...
==> : ERROR: Error installing compass:
==> : ERROR: Failed to build gem native extension.
==> :
==> : /usr/bin/ruby1.9.1 extconf.rb
==> : /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
==> : from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
==> : from extconf.rb:4:in `<main>'
==> :
==> :
==> : Gem files will remain installed in /var/lib/gems/1.9.1/gems/ffi-1.9.8 for inspection.
==> : Results logged to /var/lib/gems/1.9.1/gems/ffi-1.9.8/ext/ffi_c/gem_make.out
vagrant
ruby_gems = [ # List any Ruby Gems that you want to install
#»jekyll»,
«sass»,
«compass»,
«bootstrap-sass»
]
I tried after installing the ruby
sudo apt-get install ruby-dev
this is for additional files to build executables. And its worked
Same error but strangely enough only for Compass
@fideloper @exuperok
I recently encountered this error and i have included that the entire RVM system install gets botched because I was trying to install a key behind my companies firewall. The command:
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
Uses the port 11371 which is blocked by the firewall. What actually worked was using the recommended command to get this key:
command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
then i could do:
curl -sSL https://get.rvm.io | bash -s stable --ruby
After which I could get ruby > 2.0.
Is it possible if we could modify the Vaprobash scripts to support this command instead?
Thanks,
Adam
Gotcha — yeah that sounds like a good alternative.
On Tue, May 12, 2015 at 1:10 PM Adam Klein notifications@github.com wrote:
@fideloper https://github.com/fideloper @exuperok
https://github.com/exuperokI recently encountered this error and i have included that the entire RVM
system install gets botched because I was trying to install a key behind my
companies firewall. The command:gpg —keyserver hkp://keys.gnupg.net —recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
Uses the port 11371 which is blocked by the firewall. What actually worked
was using the recommended command to get this key:command curl -sSL https://rvm.io/mpapis.asc | gpg —import —
then i could do:
curl -sSL https://get.rvm.io | bash -s stable —ruby
After which I could get ruby > 2.0.
Is it possible if we could modify the Vaprobash scripts to support this
command instead?Thanks,
Adam—
Reply to this email directly or view it on GitHub
#458 (comment)
.
@cmosguy thanks for this, it worked for me!
From trying to do bundle I get:
$ gem install bundler
Fetching: bundler-1.2.0.gem (100%)
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /var/lib/gems
jokerdino♦
40.7k24 gold badges131 silver badges201 bronze badges
asked Sep 15, 2012 at 17:58
Michael DurrantMichael Durrant
10.5k21 gold badges58 silver badges81 bronze badges
Add this to the bottom of .bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM
answered Sep 15, 2012 at 17:58
Michael DurrantMichael Durrant
10.5k21 gold badges58 silver badges81 bronze badges
Have you tried executing this as superuser?
sudo gem install bundler
Or, you could try changing the /var/lib/gems
modes using chmod
.
answered Sep 15, 2012 at 19:34
1
Try this:
sudo apt-get install -y build-essential ruby ruby-dev
sudo env REALLY_GEM_UPDATE_SYSTEM=1 gem update --system
sudo gem install bundler
mkdir ~/test
cd ~/test
echo "source 'https://rubygems.org'" > Gemfile
echo "gem 'rake'" >> Gemfile
bundle install
Alaa Ali
30.5k11 gold badges93 silver badges105 bronze badges
answered Sep 24, 2013 at 5:59
I think that problem comes from the fact that the shell (in the terminal) you are running the bundler in, is not a login shell. Make it a login shell as follows:
bash —login
answered Nov 13, 2013 at 4:50
I’m trying to install the Middleman gem on a completely generic installation of Ubuntu Trusty (i386). Here’s my console input/output:
vagrant@vagrant-ubuntu-trusty-32:~/rj$ which ruby
/usr/bin/ruby
vagrant@vagrant-ubuntu-trusty-32:~/rj$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [i686-linux]
vagrant@vagrant-ubuntu-trusty-32:~/rj$ gem install middleman
Fetching: bundler-1.7.7.gem (100%)
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /var/lib/gems
As you can see, I’m using a Vagrant VM after getting similar errors on my host system. (Another answer to someone else’s previous question had pointed me toward both Vagrant and Docker, each of which has given output like the lines above.) Interestingly, even using sudo gem install middleman
gives me problems.
(I thought about pasting that output here, and I still might if someone asks, but to be honest, I’d rather avoid installing external gems as root if possible, preferring to focus on the errors above. The whole point of middleman, after all, is to create a defined set of flat outputs, limiting the need for privileges and customizations.)
Has anyone encountered errors like this before?
======================
EDIT: By request, here’s the output when I use sudo gem install middleman
:
Fetching: bundler-1.7.7.gem (100%)
Fetching: rack-1.5.2.gem (100%)
Fetching: tilt-1.4.1.gem (100%)
Fetching: erubis-2.7.0.gem (100%)
Fetching: uber-0.0.11.gem (100%)
Fetching: hooks-0.4.0.gem (100%)
Fetching: rack-test-0.6.2.gem (100%)
Fetching: thor-0.19.1.gem (100%)
Fetching: i18n-0.6.11.gem (100%)
Fetching: json-1.8.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing middleman:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.8.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
197 votes
4 answers
Get the solution ↓↓↓
I am trying to install create a new app in Ruby on Rails and I cannot get passed this error:
$ gem install pg
ERROR: While executing gem … (Errno::EACCES)
Permission denied @ rb_sysopen — /Users/stormyramsey/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/pg-0.21.0/.gemtest
2021-12-25
Write your answer
737
votes
Answer
Solution:
Its a permissions issue. You could fix it with this:
sudo chown -R $(whoami) /Library/Ruby/Gems/*
or possibly in your case
sudo chown -R $(whoami) /Users/stormyramsey/.rbenv/versions/2.3.2/lib/ruby/gems/*
What does this do:
This is telling the system to change the files to change the ownership to the current user. Something must have gotten messed up when something got installed. Usually this is because there are multiple accounts or users are using sudo to install when they should not always have to.
683
votes
Answer
Solution:
It’s likely there’s a permissions problem somewhere along the .rbenv path. You might try turning on write privileges for your user with:
$ chmod -R +w ~/.rbenv
That will recursively (-R
) change the file mode (chmod
) to write permission (+w
) for all files and directories under your user’s .rbenv path. There’s no particular reason for not having files set to write.
472
votes
Answer
Solution:
Delete the pod folder, reinstall it again. If it doesn’t work use this command:
sudo pod install --allow-root
508
votes
Answer
Solution:
For Mac M1 systems try,
-
Allowing full disk access to terminal.
Apple->systemPreferences->Security&Privacy->privacy(Tab)->’+’ button, check in Terminal application.
Then Restart terminal
2.Try using,sudo chflags noschg
Share solution ↓
Additional Information:
Date the issue was resolved:
2021-12-25
Link To Source
Link To Answer
People are also looking for solutions of the problem: your system folder path does not appear to be set correctly. please open the following file and correct this: index.php
Didn’t find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Модератор: Модераторы разделов
-
NARKOZ
- Сообщения: 31
- ОС: Fedora 14 / CentOS 5.5
Настройка RubyGems
Установил Ruby, Gem, Rails.
Проблема в том, что gem install что-то выдает:
Код: Выделить всё
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /home/USERNAME
А вот, что мне выдает gem env:
Код: Выделить всё
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.6
- RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/USERNAME/.gems
- RUBYGEMS PREFIX: /home/narkoz
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /home/USERNAME/.gems/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/USERNAME/.gems
- /usr/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gempath" => ["/home/USERNAME/.gems", "/usr/lib/ruby/gems/1.8"]
- "gemhome" => "/home/USERNAME/.gems"
- REMOTE SOURCES:
- http://rubygems.org/
Я думаю, мне нужно сменить USERNAME на narkoz. Как и где это можно сделать?
И вот, что прописано в .bash_profile:
Код: Выделить всё
export GEM_HOME="$HOME/.gem"
export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gem/1.8"
export PATH="$RUN/.gems/bin:$PATH"
export RUBYLIB="$RUN/lib:$RUBYLIB"
export PATH=$HOME/local/bin:$PATH
export PATH="$HOME/bin:$HOME/.gems/bin:$PATH"
export RUBYLIB="$HOME/lib:$RUBYLIB"
——BEGIN PGP SIGNATURE——
Version: GnuPG v1.4.9 (GNU/Linux)
——END PGP SIGNATURE——
-
NARKOZ
- Сообщения: 31
- ОС: Fedora 14 / CentOS 5.5
Re: Настройка RubyGems
Сообщение
NARKOZ » 15.06.2010 15:38
Код: Выделить всё
[iserv]$ echo $HOME
/home/narkoz
[iserv]$ echo $GEM_HOME
/home/narkoz/.gem
* черт. удалил папки, чтобы переустановить, нашел файл .gemrc:
Код: Выделить всё
gemhome: /home/USERNAME/.gems
gempath:
- /home/USERNAME/.gems
- /usr/lib/ruby/gems/1.8
——BEGIN PGP SIGNATURE——
Version: GnuPG v1.4.9 (GNU/Linux)
——END PGP SIGNATURE——
-
NARKOZ
- Сообщения: 31
- ОС: Fedora 14 / CentOS 5.5
Re: Настройка RubyGems
Сообщение
NARKOZ » 16.06.2010 02:05
nickm писал(а): ↑
15.06.2010 22:48
всё оказалось гораздо проще wink.gif
Всё равно переставил заново, заодно и рельсы обновил.
——BEGIN PGP SIGNATURE——
Version: GnuPG v1.4.9 (GNU/Linux)
——END PGP SIGNATURE——
My system is MAC. I am typing the following command:
sudo npm install -g aglio
The following problems arise:
npm WARN deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: Please update to at least constantinople 3.1.1
npm WARN deprecated [email protected]: Deprecated, use jstransformer
npm WARN deprecated [email protected]: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated [email protected]: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated [email protected]: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
/usr/local/bin/aglio -> /usr/local/lib/node_modules/aglio/bin/aglio.js
> [email protected] install /usr/local/lib/node_modules/aglio/node_modules/fsevents
> node install
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v57 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/aglio/node_modules/fsevents/lib'
gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/eric/.node-gyp/8.12.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/aglio/node_modules/fsevents/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/aglio/node_modules/fsevents/.node-gyp'
gyp ERR! System Darwin 18.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/aglio/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" "--module_name=fse" "--module_path=/usr/local/lib/node_modules/aglio/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /usr/local/lib/node_modules/aglio/node_modules/fsevents
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/aglio/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/aglio/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/aglio/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:915:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Darwin 18.0.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/aglio/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/aglio/node_modules/fsevents
node-pre-gyp ERR! node -v v8.12.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/aglio/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/aglio/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
> [email protected] install /usr/local/lib/node_modules/aglio/node_modules/protagonist
> node-gyp rebuild
gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/eric/.node-gyp/8.12.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/aglio/node_modules/protagonist/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/aglio/node_modules/protagonist/.node-gyp'
gyp ERR! System Darwin 18.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/aglio/node_modules/protagonist
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
> [email protected] postinstall /usr/local/lib/node_modules/aglio/node_modules/aglio-theme-olio
> node scripts/setup-cache.js
fs.js:885
return binding.mkdir(pathModule._makeLong(path),
^
Error: EACCES: permission denied, mkdir './cache'
at Object.fs.mkdirSync (fs.js:885:18)
at Object.<anonymous> (/usr/local/lib/node_modules/aglio/node_modules/aglio-theme-olio/scripts/setup-cache.js:14:6)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/aglio/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/aglio/node_modules/protagonist):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/setup-cache.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/eric/.npm/_logs/2019-02-14T00_47_21_128Z-debug.log
According to the research, the correct approach should be:
sudo npm install -g aglio --unsafe-perm=true --allow-root
And then it’s normal.
reference
[1].Error: EACCES: permission denied, mkdir ‘/root/.nvm/versions/node/……. https://www.jianshu.com/p/6c67a456654b