Problems installing “rails” in Ubuntu
up vote
0
down vote
favorite
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 |
up vote
0
down vote
favorite
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 at 1:57
2
You almost certainly didsudo gem installon some other gem previously, and now your/home/bernardo/.gemdirectory 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 installfor any reason.
– Jim Stewart
Nov 20 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 at 6:52
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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 at 1:11
Bernardo 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 at 1:57
2
You almost certainly didsudo gem installon some other gem previously, and now your/home/bernardo/.gemdirectory 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 installfor any reason.
– Jim Stewart
Nov 20 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 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 at 1:57
2
You almost certainly didsudo gem installon some other gem previously, and now your/home/bernardo/.gemdirectory 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 installfor any reason.
– Jim Stewart
Nov 20 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 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 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 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 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 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 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 at 6:52
add a comment |
4 Answers
4
active
oldest
votes
up vote
0
down vote
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 |
up vote
0
down vote
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 |
up vote
0
down vote
Never install a gem with sudo command.
use
gem install rails
instead of
sudo gem install rails
add a comment |
up vote
-1
down vote
Use sudo gem install rails May helps you.
add a comment |
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
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 |
up vote
0
down vote
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 |
up vote
0
down vote
up vote
0
down vote
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 at 5:39
Cryptex Technologies
517110
517110
add a comment |
add a comment |
up vote
0
down vote
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 |
up vote
0
down vote
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 |
up vote
0
down vote
up vote
0
down vote
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 at 8:06
Pang
6,8301563101
6,8301563101
answered Nov 20 at 6:43
widjajayd
2,42731223
2,42731223
add a comment |
add a comment |
up vote
0
down vote
Never install a gem with sudo command.
use
gem install rails
instead of
sudo gem install rails
add a comment |
up vote
0
down vote
Never install a gem with sudo command.
use
gem install rails
instead of
sudo gem install rails
add a comment |
up vote
0
down vote
up vote
0
down vote
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 at 9:30
Vikram Sharma
30536
30536
add a comment |
add a comment |
up vote
-1
down vote
Use sudo gem install rails May helps you.
add a comment |
up vote
-1
down vote
Use sudo gem install rails May helps you.
add a comment |
up vote
-1
down vote
up vote
-1
down vote
Use sudo gem install rails May helps you.
Use sudo gem install rails May helps you.
answered Nov 20 at 8:02
Maheshkumar.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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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 at 1:57
2
You almost certainly did
sudo gem installon some other gem previously, and now your/home/bernardo/.gemdirectory 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 installfor any reason.– Jim Stewart
Nov 20 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 at 6:52