Problems installing “rails” in Ubuntu
I am new to programming and trying to install Rails on Ubuntu 18.10, but I get the following error when running $ gem install rails. How do I avoid this error and install rails?
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ dir_s_mkdir - /home/bernardo/.gem/specs
I'm running Ruby 2.5.3p105
ruby-on-rails ruby linux ubuntu
add a comment |
I am new to programming and trying to install Rails on Ubuntu 18.10, but I get the following error when running $ gem install rails. How do I avoid this error and install rails?
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ dir_s_mkdir - /home/bernardo/.gem/specs
I'm running Ruby 2.5.3p105
ruby-on-rails ruby linux ubuntu
Howdy, looks like your issue is related to permissions on your system. You could get around that by running sudo in front of your command. However i think your best course of action is to remove ruby from your system (sudo apt-get purge ruby) and then start over with rbenv. github.com/rbenv/rbenv
– Austio
Nov 20 '18 at 1:57
2
You almost certainly didsudo gem install
on some other gem previously, and now your/home/bernardo/.gem
directory is owned byroot
. The easiest way to fix this is a bit of a sledgehammer, but you should do it:sudo rm -rf ~/.gem
, and then reinstall any gems you want. This will delete all your gems (some of which are owned by root), but it'll fix your problem. Just do that and then reinstall the gems you want, and never eversudo gem install
for any reason.
– Jim Stewart
Nov 20 '18 at 6:47
@Austio above is on the right track, but wrong about the underlying cause, and purging/reinstalling Ruby is not going to help.
– Jim Stewart
Nov 20 '18 at 6:52
add a comment |
I am new to programming and trying to install Rails on Ubuntu 18.10, but I get the following error when running $ gem install rails. How do I avoid this error and install rails?
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ dir_s_mkdir - /home/bernardo/.gem/specs
I'm running Ruby 2.5.3p105
ruby-on-rails ruby linux ubuntu
I am new to programming and trying to install Rails on Ubuntu 18.10, but I get the following error when running $ gem install rails. How do I avoid this error and install rails?
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ dir_s_mkdir - /home/bernardo/.gem/specs
I'm running Ruby 2.5.3p105
ruby-on-rails ruby linux ubuntu
ruby-on-rails ruby linux ubuntu
asked Nov 20 '18 at 1:11
Bernardo Garza LandaBernardo Garza Landa
1
1
Howdy, looks like your issue is related to permissions on your system. You could get around that by running sudo in front of your command. However i think your best course of action is to remove ruby from your system (sudo apt-get purge ruby) and then start over with rbenv. github.com/rbenv/rbenv
– Austio
Nov 20 '18 at 1:57
2
You almost certainly didsudo gem install
on some other gem previously, and now your/home/bernardo/.gem
directory is owned byroot
. The easiest way to fix this is a bit of a sledgehammer, but you should do it:sudo rm -rf ~/.gem
, and then reinstall any gems you want. This will delete all your gems (some of which are owned by root), but it'll fix your problem. Just do that and then reinstall the gems you want, and never eversudo gem install
for any reason.
– Jim Stewart
Nov 20 '18 at 6:47
@Austio above is on the right track, but wrong about the underlying cause, and purging/reinstalling Ruby is not going to help.
– Jim Stewart
Nov 20 '18 at 6:52
add a comment |
Howdy, looks like your issue is related to permissions on your system. You could get around that by running sudo in front of your command. However i think your best course of action is to remove ruby from your system (sudo apt-get purge ruby) and then start over with rbenv. github.com/rbenv/rbenv
– Austio
Nov 20 '18 at 1:57
2
You almost certainly didsudo gem install
on some other gem previously, and now your/home/bernardo/.gem
directory is owned byroot
. The easiest way to fix this is a bit of a sledgehammer, but you should do it:sudo rm -rf ~/.gem
, and then reinstall any gems you want. This will delete all your gems (some of which are owned by root), but it'll fix your problem. Just do that and then reinstall the gems you want, and never eversudo gem install
for any reason.
– Jim Stewart
Nov 20 '18 at 6:47
@Austio above is on the right track, but wrong about the underlying cause, and purging/reinstalling Ruby is not going to help.
– Jim Stewart
Nov 20 '18 at 6:52
Howdy, looks like your issue is related to permissions on your system. You could get around that by running sudo in front of your command. However i think your best course of action is to remove ruby from your system (sudo apt-get purge ruby) and then start over with rbenv. github.com/rbenv/rbenv
– Austio
Nov 20 '18 at 1:57
Howdy, looks like your issue is related to permissions on your system. You could get around that by running sudo in front of your command. However i think your best course of action is to remove ruby from your system (sudo apt-get purge ruby) and then start over with rbenv. github.com/rbenv/rbenv
– Austio
Nov 20 '18 at 1:57
2
2
You almost certainly did
sudo gem install
on some other gem previously, and now your /home/bernardo/.gem
directory is owned by root
. The easiest way to fix this is a bit of a sledgehammer, but you should do it: sudo rm -rf ~/.gem
, and then reinstall any gems you want. This will delete all your gems (some of which are owned by root), but it'll fix your problem. Just do that and then reinstall the gems you want, and never ever sudo gem install
for any reason.– Jim Stewart
Nov 20 '18 at 6:47
You almost certainly did
sudo gem install
on some other gem previously, and now your /home/bernardo/.gem
directory is owned by root
. The easiest way to fix this is a bit of a sledgehammer, but you should do it: sudo rm -rf ~/.gem
, and then reinstall any gems you want. This will delete all your gems (some of which are owned by root), but it'll fix your problem. Just do that and then reinstall the gems you want, and never ever sudo gem install
for any reason.– Jim Stewart
Nov 20 '18 at 6:47
@Austio above is on the right track, but wrong about the underlying cause, and purging/reinstalling Ruby is not going to help.
– Jim Stewart
Nov 20 '18 at 6:52
@Austio above is on the right track, but wrong about the underlying cause, and purging/reinstalling Ruby is not going to help.
– Jim Stewart
Nov 20 '18 at 6:52
add a comment |
4 Answers
4
active
oldest
votes
Just go through the steps given in below link: https://gorails.com/setup/ubuntu/16.04
and make sure you install ruby using rvm and set is default ruby. Then install rails.
This will resolve your issue.
If still the problem is not resolved, then remove previously installed ruby and go through all the steps for ruby and rails installation.
add a comment |
Here are the steps that I took to install rbenv in ubuntu server
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv -v
rbenv install 2.5.3
rbenv global 2.5.3
rbenv rehash
ruby -v
gem install bundler
# inside rails application
bundle install
Explanation:
- Line 1: clone rbenv project
- line 2-4: enter rbenv path and settings to your bashrc
- rbenv -v = check whether your rbenv is running correctly
- then install ruby version (I checked above you running version 2.5.3)
- rbenv global 2.5.3 (set version 2.5.3 in any folder paths)
- rbenv rehash (after you set global / local make sure you do rehash)
add a comment |
Never install a gem with sudo command.
use
gem install rails
instead of
sudo gem install rails
add a comment |
Use sudo gem install rails
May helps you.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53384844%2fproblems-installing-rails-in-ubuntu%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Just go through the steps given in below link: https://gorails.com/setup/ubuntu/16.04
and make sure you install ruby using rvm and set is default ruby. Then install rails.
This will resolve your issue.
If still the problem is not resolved, then remove previously installed ruby and go through all the steps for ruby and rails installation.
add a comment |
Just go through the steps given in below link: https://gorails.com/setup/ubuntu/16.04
and make sure you install ruby using rvm and set is default ruby. Then install rails.
This will resolve your issue.
If still the problem is not resolved, then remove previously installed ruby and go through all the steps for ruby and rails installation.
add a comment |
Just go through the steps given in below link: https://gorails.com/setup/ubuntu/16.04
and make sure you install ruby using rvm and set is default ruby. Then install rails.
This will resolve your issue.
If still the problem is not resolved, then remove previously installed ruby and go through all the steps for ruby and rails installation.
Just go through the steps given in below link: https://gorails.com/setup/ubuntu/16.04
and make sure you install ruby using rvm and set is default ruby. Then install rails.
This will resolve your issue.
If still the problem is not resolved, then remove previously installed ruby and go through all the steps for ruby and rails installation.
answered Nov 20 '18 at 5:39
Cryptex TechnologiesCryptex Technologies
790213
790213
add a comment |
add a comment |
Here are the steps that I took to install rbenv in ubuntu server
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv -v
rbenv install 2.5.3
rbenv global 2.5.3
rbenv rehash
ruby -v
gem install bundler
# inside rails application
bundle install
Explanation:
- Line 1: clone rbenv project
- line 2-4: enter rbenv path and settings to your bashrc
- rbenv -v = check whether your rbenv is running correctly
- then install ruby version (I checked above you running version 2.5.3)
- rbenv global 2.5.3 (set version 2.5.3 in any folder paths)
- rbenv rehash (after you set global / local make sure you do rehash)
add a comment |
Here are the steps that I took to install rbenv in ubuntu server
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv -v
rbenv install 2.5.3
rbenv global 2.5.3
rbenv rehash
ruby -v
gem install bundler
# inside rails application
bundle install
Explanation:
- Line 1: clone rbenv project
- line 2-4: enter rbenv path and settings to your bashrc
- rbenv -v = check whether your rbenv is running correctly
- then install ruby version (I checked above you running version 2.5.3)
- rbenv global 2.5.3 (set version 2.5.3 in any folder paths)
- rbenv rehash (after you set global / local make sure you do rehash)
add a comment |
Here are the steps that I took to install rbenv in ubuntu server
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv -v
rbenv install 2.5.3
rbenv global 2.5.3
rbenv rehash
ruby -v
gem install bundler
# inside rails application
bundle install
Explanation:
- Line 1: clone rbenv project
- line 2-4: enter rbenv path and settings to your bashrc
- rbenv -v = check whether your rbenv is running correctly
- then install ruby version (I checked above you running version 2.5.3)
- rbenv global 2.5.3 (set version 2.5.3 in any folder paths)
- rbenv rehash (after you set global / local make sure you do rehash)
Here are the steps that I took to install rbenv in ubuntu server
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv -v
rbenv install 2.5.3
rbenv global 2.5.3
rbenv rehash
ruby -v
gem install bundler
# inside rails application
bundle install
Explanation:
- Line 1: clone rbenv project
- line 2-4: enter rbenv path and settings to your bashrc
- rbenv -v = check whether your rbenv is running correctly
- then install ruby version (I checked above you running version 2.5.3)
- rbenv global 2.5.3 (set version 2.5.3 in any folder paths)
- rbenv rehash (after you set global / local make sure you do rehash)
edited Nov 20 '18 at 8:06
Pang
6,9011664102
6,9011664102
answered Nov 20 '18 at 6:43
widjajaydwidjajayd
3,23231323
3,23231323
add a comment |
add a comment |
Never install a gem with sudo command.
use
gem install rails
instead of
sudo gem install rails
add a comment |
Never install a gem with sudo command.
use
gem install rails
instead of
sudo gem install rails
add a comment |
Never install a gem with sudo command.
use
gem install rails
instead of
sudo gem install rails
Never install a gem with sudo command.
use
gem install rails
instead of
sudo gem install rails
answered Nov 20 '18 at 9:30
Vikram SharmaVikram Sharma
30536
30536
add a comment |
add a comment |
Use sudo gem install rails
May helps you.
add a comment |
Use sudo gem install rails
May helps you.
add a comment |
Use sudo gem install rails
May helps you.
Use sudo gem install rails
May helps you.
answered Nov 20 '18 at 8:02
Maheshkumar.JMaheshkumar.J
147
147
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53384844%2fproblems-installing-rails-in-ubuntu%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Howdy, looks like your issue is related to permissions on your system. You could get around that by running sudo in front of your command. However i think your best course of action is to remove ruby from your system (sudo apt-get purge ruby) and then start over with rbenv. github.com/rbenv/rbenv
– Austio
Nov 20 '18 at 1:57
2
You almost certainly did
sudo gem install
on some other gem previously, and now your/home/bernardo/.gem
directory is owned byroot
. The easiest way to fix this is a bit of a sledgehammer, but you should do it:sudo rm -rf ~/.gem
, and then reinstall any gems you want. This will delete all your gems (some of which are owned by root), but it'll fix your problem. Just do that and then reinstall the gems you want, and never eversudo gem install
for any reason.– Jim Stewart
Nov 20 '18 at 6:47
@Austio above is on the right track, but wrong about the underlying cause, and purging/reinstalling Ruby is not going to help.
– Jim Stewart
Nov 20 '18 at 6:52