How do I fix the “You don't have write permissions into the /usr/bin directory” error when installing...
I'm trying to install Rails 3 on a brand new MacBook Pro running OS X 10.6.3, Ruby 1.8.7, and Rails 2.3.5 and I'm wondering if I've hosed myself. So far, I've run these commands:
$ gem update --system
$ gem install arel tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
$ gem install rails --pre
However, when I run the last command, I get this error:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /usr/bin directory.
I think it wants me to run the command with sudo
so that it can write over /usr/bin/rails
. But if I do that, won't I be overwriting my Rails 2.3.5 executable? I don't want to do that. Instead, I'd like to keep both versions of Rails. How do I do that?
ruby-on-rails-3
add a comment |
I'm trying to install Rails 3 on a brand new MacBook Pro running OS X 10.6.3, Ruby 1.8.7, and Rails 2.3.5 and I'm wondering if I've hosed myself. So far, I've run these commands:
$ gem update --system
$ gem install arel tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
$ gem install rails --pre
However, when I run the last command, I get this error:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /usr/bin directory.
I think it wants me to run the command with sudo
so that it can write over /usr/bin/rails
. But if I do that, won't I be overwriting my Rails 2.3.5 executable? I don't want to do that. Instead, I'd like to keep both versions of Rails. How do I do that?
ruby-on-rails-3
I was getting same error on first command, use this commandsudo gem update --system -n /usr/local/bin
– nitish005
May 3 '18 at 7:00
Bravo @nitish005 !!!
– Alessign
May 24 '18 at 15:33
What is the -n?
– Scott Romack
Nov 20 '18 at 13:58
add a comment |
I'm trying to install Rails 3 on a brand new MacBook Pro running OS X 10.6.3, Ruby 1.8.7, and Rails 2.3.5 and I'm wondering if I've hosed myself. So far, I've run these commands:
$ gem update --system
$ gem install arel tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
$ gem install rails --pre
However, when I run the last command, I get this error:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /usr/bin directory.
I think it wants me to run the command with sudo
so that it can write over /usr/bin/rails
. But if I do that, won't I be overwriting my Rails 2.3.5 executable? I don't want to do that. Instead, I'd like to keep both versions of Rails. How do I do that?
ruby-on-rails-3
I'm trying to install Rails 3 on a brand new MacBook Pro running OS X 10.6.3, Ruby 1.8.7, and Rails 2.3.5 and I'm wondering if I've hosed myself. So far, I've run these commands:
$ gem update --system
$ gem install arel tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
$ gem install rails --pre
However, when I run the last command, I get this error:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /usr/bin directory.
I think it wants me to run the command with sudo
so that it can write over /usr/bin/rails
. But if I do that, won't I be overwriting my Rails 2.3.5 executable? I don't want to do that. Instead, I'd like to keep both versions of Rails. How do I do that?
ruby-on-rails-3
ruby-on-rails-3
edited Nov 18 '11 at 18:42
George Stocker♦
45.7k28155217
45.7k28155217
asked May 23 '10 at 23:13
JimJim
4,07995690
4,07995690
I was getting same error on first command, use this commandsudo gem update --system -n /usr/local/bin
– nitish005
May 3 '18 at 7:00
Bravo @nitish005 !!!
– Alessign
May 24 '18 at 15:33
What is the -n?
– Scott Romack
Nov 20 '18 at 13:58
add a comment |
I was getting same error on first command, use this commandsudo gem update --system -n /usr/local/bin
– nitish005
May 3 '18 at 7:00
Bravo @nitish005 !!!
– Alessign
May 24 '18 at 15:33
What is the -n?
– Scott Romack
Nov 20 '18 at 13:58
I was getting same error on first command, use this command
sudo gem update --system -n /usr/local/bin
– nitish005
May 3 '18 at 7:00
I was getting same error on first command, use this command
sudo gem update --system -n /usr/local/bin
– nitish005
May 3 '18 at 7:00
Bravo @nitish005 !!!
– Alessign
May 24 '18 at 15:33
Bravo @nitish005 !!!
– Alessign
May 24 '18 at 15:33
What is the -n?
– Scott Romack
Nov 20 '18 at 13:58
What is the -n?
– Scott Romack
Nov 20 '18 at 13:58
add a comment |
8 Answers
8
active
oldest
votes
I'd suggest using RVM it allows you have multiple versions of Ruby/Rails installed with gem profiles and basically keep all your gems contained from one another. You may want to check out a similar post How can I install Ruby on Rails 3 on OSX
only doing that solved for me a similar problem with the same error message
– Richard Rich Steinmetz
Oct 26 '18 at 18:59
add a comment |
use -n
parameter to install like for cocoapods:
sudo gem install cocoapods -n /usr/local/bin
4
Why would we even need this?
– nenchev
Oct 31 '17 at 18:54
7
Fails on MacOS unless you specify -n /usr/local/bin. Thanks for the solution
– Sacky San
Dec 12 '17 at 23:22
1
Thank you so much, you saved my day! My cocoapods suddenly stopped working this morning.
– Lucas P.
Dec 19 '17 at 19:34
1
What does -n means?
– allenlinli
Apr 3 '18 at 3:20
according to guides.rubygems.org/command-reference/#gem-install, -n specifies the directory where binaries are located. I also needed-n /usr/local/bin
on my Mac. I ranwhich pod
to determine its existing location before using the -n option which was indeed /usr/local/bin
– mwu
Apr 3 '18 at 18:07
|
show 2 more comments
You can use sudo gem install -n /usr/local/bin cocoapods
This works for me.
add a comment |
To fix your specific error you need to run that command as sudo, ie:
sudo gem install rails --pre
NO. Use rvm or rbenv ...do not just sudo.
– doublejosh
Oct 9 '17 at 23:50
add a comment |
sudo gem install cocoapods --pre -n /usr/local/bin
This works for me.
add a comment |
Using the -n /usr/local/bin flag does work, BUT I had to come back to this page every time I wanted to update a package again. So I figured out a permanent fix for this.
For those interested in fixing this permanently:
Create a ~/.gemrc file
`vim .gemrc`
Add the following to it:
`:gemdir:
- ~/.gem/ruby
install: -n /usr/local/bin`
Now you can run your command normally without the -n flag.
Enjoy!
vim .gemrc
how to write this cmd
– Chandni
Jan 7 at 8:07
I am not sure this will work in Window$, but I guess you could use Notepad.
– Francois Nadeau
Jan 7 at 14:06
add a comment |
This Error hit me after installing RVM correctly.
Solution: re-boot Terminal.
Reference RailsCast's RVM Install tutorial.
1
7 years later, your solution worked, pal!
– Antonio Pavicevac-Ortiz
May 23 '17 at 22:53
Not exactly 7 years later, but this works also if you're working on windows bash subsystem. Just exit the bash and launch it again. Thank you.
– Pedro Madrid
Feb 5 '18 at 15:39
add a comment |
For me, something different worked, that I found in on this answer from a similar question. Probably won't help OP, but maybe someone like me that had a similar problem.
You should indeed use rvm, but as no one explained to you how to do this without rvm, here you go:
sudo gem install tzinfo builder memcache-client rack rack-test rack-mount
abstract erubis activesupport mime-types mail text-hyphen text-format
thor i18n rake bundler arel railties rails --prerelease --force
add a comment |
8 Answers
8
active
oldest
votes
8 Answers
8
active
oldest
votes
active
oldest
votes
active
oldest
votes
I'd suggest using RVM it allows you have multiple versions of Ruby/Rails installed with gem profiles and basically keep all your gems contained from one another. You may want to check out a similar post How can I install Ruby on Rails 3 on OSX
only doing that solved for me a similar problem with the same error message
– Richard Rich Steinmetz
Oct 26 '18 at 18:59
add a comment |
I'd suggest using RVM it allows you have multiple versions of Ruby/Rails installed with gem profiles and basically keep all your gems contained from one another. You may want to check out a similar post How can I install Ruby on Rails 3 on OSX
only doing that solved for me a similar problem with the same error message
– Richard Rich Steinmetz
Oct 26 '18 at 18:59
add a comment |
I'd suggest using RVM it allows you have multiple versions of Ruby/Rails installed with gem profiles and basically keep all your gems contained from one another. You may want to check out a similar post How can I install Ruby on Rails 3 on OSX
I'd suggest using RVM it allows you have multiple versions of Ruby/Rails installed with gem profiles and basically keep all your gems contained from one another. You may want to check out a similar post How can I install Ruby on Rails 3 on OSX
edited May 23 '17 at 12:34
Community♦
11
11
answered May 27 '10 at 9:52
TarellelTarellel
8291315
8291315
only doing that solved for me a similar problem with the same error message
– Richard Rich Steinmetz
Oct 26 '18 at 18:59
add a comment |
only doing that solved for me a similar problem with the same error message
– Richard Rich Steinmetz
Oct 26 '18 at 18:59
only doing that solved for me a similar problem with the same error message
– Richard Rich Steinmetz
Oct 26 '18 at 18:59
only doing that solved for me a similar problem with the same error message
– Richard Rich Steinmetz
Oct 26 '18 at 18:59
add a comment |
use -n
parameter to install like for cocoapods:
sudo gem install cocoapods -n /usr/local/bin
4
Why would we even need this?
– nenchev
Oct 31 '17 at 18:54
7
Fails on MacOS unless you specify -n /usr/local/bin. Thanks for the solution
– Sacky San
Dec 12 '17 at 23:22
1
Thank you so much, you saved my day! My cocoapods suddenly stopped working this morning.
– Lucas P.
Dec 19 '17 at 19:34
1
What does -n means?
– allenlinli
Apr 3 '18 at 3:20
according to guides.rubygems.org/command-reference/#gem-install, -n specifies the directory where binaries are located. I also needed-n /usr/local/bin
on my Mac. I ranwhich pod
to determine its existing location before using the -n option which was indeed /usr/local/bin
– mwu
Apr 3 '18 at 18:07
|
show 2 more comments
use -n
parameter to install like for cocoapods:
sudo gem install cocoapods -n /usr/local/bin
4
Why would we even need this?
– nenchev
Oct 31 '17 at 18:54
7
Fails on MacOS unless you specify -n /usr/local/bin. Thanks for the solution
– Sacky San
Dec 12 '17 at 23:22
1
Thank you so much, you saved my day! My cocoapods suddenly stopped working this morning.
– Lucas P.
Dec 19 '17 at 19:34
1
What does -n means?
– allenlinli
Apr 3 '18 at 3:20
according to guides.rubygems.org/command-reference/#gem-install, -n specifies the directory where binaries are located. I also needed-n /usr/local/bin
on my Mac. I ranwhich pod
to determine its existing location before using the -n option which was indeed /usr/local/bin
– mwu
Apr 3 '18 at 18:07
|
show 2 more comments
use -n
parameter to install like for cocoapods:
sudo gem install cocoapods -n /usr/local/bin
use -n
parameter to install like for cocoapods:
sudo gem install cocoapods -n /usr/local/bin
edited Jan 25 '16 at 10:00
Tunaki
89.4k22193269
89.4k22193269
answered Jan 25 '16 at 9:59
Pradeep KachhawahaPradeep Kachhawaha
2,4932913
2,4932913
4
Why would we even need this?
– nenchev
Oct 31 '17 at 18:54
7
Fails on MacOS unless you specify -n /usr/local/bin. Thanks for the solution
– Sacky San
Dec 12 '17 at 23:22
1
Thank you so much, you saved my day! My cocoapods suddenly stopped working this morning.
– Lucas P.
Dec 19 '17 at 19:34
1
What does -n means?
– allenlinli
Apr 3 '18 at 3:20
according to guides.rubygems.org/command-reference/#gem-install, -n specifies the directory where binaries are located. I also needed-n /usr/local/bin
on my Mac. I ranwhich pod
to determine its existing location before using the -n option which was indeed /usr/local/bin
– mwu
Apr 3 '18 at 18:07
|
show 2 more comments
4
Why would we even need this?
– nenchev
Oct 31 '17 at 18:54
7
Fails on MacOS unless you specify -n /usr/local/bin. Thanks for the solution
– Sacky San
Dec 12 '17 at 23:22
1
Thank you so much, you saved my day! My cocoapods suddenly stopped working this morning.
– Lucas P.
Dec 19 '17 at 19:34
1
What does -n means?
– allenlinli
Apr 3 '18 at 3:20
according to guides.rubygems.org/command-reference/#gem-install, -n specifies the directory where binaries are located. I also needed-n /usr/local/bin
on my Mac. I ranwhich pod
to determine its existing location before using the -n option which was indeed /usr/local/bin
– mwu
Apr 3 '18 at 18:07
4
4
Why would we even need this?
– nenchev
Oct 31 '17 at 18:54
Why would we even need this?
– nenchev
Oct 31 '17 at 18:54
7
7
Fails on MacOS unless you specify -n /usr/local/bin. Thanks for the solution
– Sacky San
Dec 12 '17 at 23:22
Fails on MacOS unless you specify -n /usr/local/bin. Thanks for the solution
– Sacky San
Dec 12 '17 at 23:22
1
1
Thank you so much, you saved my day! My cocoapods suddenly stopped working this morning.
– Lucas P.
Dec 19 '17 at 19:34
Thank you so much, you saved my day! My cocoapods suddenly stopped working this morning.
– Lucas P.
Dec 19 '17 at 19:34
1
1
What does -n means?
– allenlinli
Apr 3 '18 at 3:20
What does -n means?
– allenlinli
Apr 3 '18 at 3:20
according to guides.rubygems.org/command-reference/#gem-install, -n specifies the directory where binaries are located. I also needed
-n /usr/local/bin
on my Mac. I ran which pod
to determine its existing location before using the -n option which was indeed /usr/local/bin– mwu
Apr 3 '18 at 18:07
according to guides.rubygems.org/command-reference/#gem-install, -n specifies the directory where binaries are located. I also needed
-n /usr/local/bin
on my Mac. I ran which pod
to determine its existing location before using the -n option which was indeed /usr/local/bin– mwu
Apr 3 '18 at 18:07
|
show 2 more comments
You can use sudo gem install -n /usr/local/bin cocoapods
This works for me.
add a comment |
You can use sudo gem install -n /usr/local/bin cocoapods
This works for me.
add a comment |
You can use sudo gem install -n /usr/local/bin cocoapods
This works for me.
You can use sudo gem install -n /usr/local/bin cocoapods
This works for me.
edited May 10 '18 at 0:26
iWheelBuy
2,48122250
2,48122250
answered Dec 9 '17 at 20:00
DaminiDamini
16114
16114
add a comment |
add a comment |
To fix your specific error you need to run that command as sudo, ie:
sudo gem install rails --pre
NO. Use rvm or rbenv ...do not just sudo.
– doublejosh
Oct 9 '17 at 23:50
add a comment |
To fix your specific error you need to run that command as sudo, ie:
sudo gem install rails --pre
NO. Use rvm or rbenv ...do not just sudo.
– doublejosh
Oct 9 '17 at 23:50
add a comment |
To fix your specific error you need to run that command as sudo, ie:
sudo gem install rails --pre
To fix your specific error you need to run that command as sudo, ie:
sudo gem install rails --pre
answered May 27 '10 at 10:38
Andrew NesbittAndrew Nesbitt
5,21212430
5,21212430
NO. Use rvm or rbenv ...do not just sudo.
– doublejosh
Oct 9 '17 at 23:50
add a comment |
NO. Use rvm or rbenv ...do not just sudo.
– doublejosh
Oct 9 '17 at 23:50
NO. Use rvm or rbenv ...do not just sudo.
– doublejosh
Oct 9 '17 at 23:50
NO. Use rvm or rbenv ...do not just sudo.
– doublejosh
Oct 9 '17 at 23:50
add a comment |
sudo gem install cocoapods --pre -n /usr/local/bin
This works for me.
add a comment |
sudo gem install cocoapods --pre -n /usr/local/bin
This works for me.
add a comment |
sudo gem install cocoapods --pre -n /usr/local/bin
This works for me.
sudo gem install cocoapods --pre -n /usr/local/bin
This works for me.
edited Jun 19 '18 at 7:41
Erik von Asmuth
19.1k62138
19.1k62138
answered Jun 19 '18 at 2:41
tong Xutong Xu
7513
7513
add a comment |
add a comment |
Using the -n /usr/local/bin flag does work, BUT I had to come back to this page every time I wanted to update a package again. So I figured out a permanent fix for this.
For those interested in fixing this permanently:
Create a ~/.gemrc file
`vim .gemrc`
Add the following to it:
`:gemdir:
- ~/.gem/ruby
install: -n /usr/local/bin`
Now you can run your command normally without the -n flag.
Enjoy!
vim .gemrc
how to write this cmd
– Chandni
Jan 7 at 8:07
I am not sure this will work in Window$, but I guess you could use Notepad.
– Francois Nadeau
Jan 7 at 14:06
add a comment |
Using the -n /usr/local/bin flag does work, BUT I had to come back to this page every time I wanted to update a package again. So I figured out a permanent fix for this.
For those interested in fixing this permanently:
Create a ~/.gemrc file
`vim .gemrc`
Add the following to it:
`:gemdir:
- ~/.gem/ruby
install: -n /usr/local/bin`
Now you can run your command normally without the -n flag.
Enjoy!
vim .gemrc
how to write this cmd
– Chandni
Jan 7 at 8:07
I am not sure this will work in Window$, but I guess you could use Notepad.
– Francois Nadeau
Jan 7 at 14:06
add a comment |
Using the -n /usr/local/bin flag does work, BUT I had to come back to this page every time I wanted to update a package again. So I figured out a permanent fix for this.
For those interested in fixing this permanently:
Create a ~/.gemrc file
`vim .gemrc`
Add the following to it:
`:gemdir:
- ~/.gem/ruby
install: -n /usr/local/bin`
Now you can run your command normally without the -n flag.
Enjoy!
Using the -n /usr/local/bin flag does work, BUT I had to come back to this page every time I wanted to update a package again. So I figured out a permanent fix for this.
For those interested in fixing this permanently:
Create a ~/.gemrc file
`vim .gemrc`
Add the following to it:
`:gemdir:
- ~/.gem/ruby
install: -n /usr/local/bin`
Now you can run your command normally without the -n flag.
Enjoy!
edited Nov 21 '18 at 14:09
answered Sep 6 '18 at 2:49
Francois NadeauFrancois Nadeau
8391217
8391217
vim .gemrc
how to write this cmd
– Chandni
Jan 7 at 8:07
I am not sure this will work in Window$, but I guess you could use Notepad.
– Francois Nadeau
Jan 7 at 14:06
add a comment |
vim .gemrc
how to write this cmd
– Chandni
Jan 7 at 8:07
I am not sure this will work in Window$, but I guess you could use Notepad.
– Francois Nadeau
Jan 7 at 14:06
vim .gemrc
how to write this cmd– Chandni
Jan 7 at 8:07
vim .gemrc
how to write this cmd– Chandni
Jan 7 at 8:07
I am not sure this will work in Window$, but I guess you could use Notepad.
– Francois Nadeau
Jan 7 at 14:06
I am not sure this will work in Window$, but I guess you could use Notepad.
– Francois Nadeau
Jan 7 at 14:06
add a comment |
This Error hit me after installing RVM correctly.
Solution: re-boot Terminal.
Reference RailsCast's RVM Install tutorial.
1
7 years later, your solution worked, pal!
– Antonio Pavicevac-Ortiz
May 23 '17 at 22:53
Not exactly 7 years later, but this works also if you're working on windows bash subsystem. Just exit the bash and launch it again. Thank you.
– Pedro Madrid
Feb 5 '18 at 15:39
add a comment |
This Error hit me after installing RVM correctly.
Solution: re-boot Terminal.
Reference RailsCast's RVM Install tutorial.
1
7 years later, your solution worked, pal!
– Antonio Pavicevac-Ortiz
May 23 '17 at 22:53
Not exactly 7 years later, but this works also if you're working on windows bash subsystem. Just exit the bash and launch it again. Thank you.
– Pedro Madrid
Feb 5 '18 at 15:39
add a comment |
This Error hit me after installing RVM correctly.
Solution: re-boot Terminal.
Reference RailsCast's RVM Install tutorial.
This Error hit me after installing RVM correctly.
Solution: re-boot Terminal.
Reference RailsCast's RVM Install tutorial.
answered Dec 22 '15 at 19:41
AkornAkorn
726
726
1
7 years later, your solution worked, pal!
– Antonio Pavicevac-Ortiz
May 23 '17 at 22:53
Not exactly 7 years later, but this works also if you're working on windows bash subsystem. Just exit the bash and launch it again. Thank you.
– Pedro Madrid
Feb 5 '18 at 15:39
add a comment |
1
7 years later, your solution worked, pal!
– Antonio Pavicevac-Ortiz
May 23 '17 at 22:53
Not exactly 7 years later, but this works also if you're working on windows bash subsystem. Just exit the bash and launch it again. Thank you.
– Pedro Madrid
Feb 5 '18 at 15:39
1
1
7 years later, your solution worked, pal!
– Antonio Pavicevac-Ortiz
May 23 '17 at 22:53
7 years later, your solution worked, pal!
– Antonio Pavicevac-Ortiz
May 23 '17 at 22:53
Not exactly 7 years later, but this works also if you're working on windows bash subsystem. Just exit the bash and launch it again. Thank you.
– Pedro Madrid
Feb 5 '18 at 15:39
Not exactly 7 years later, but this works also if you're working on windows bash subsystem. Just exit the bash and launch it again. Thank you.
– Pedro Madrid
Feb 5 '18 at 15:39
add a comment |
For me, something different worked, that I found in on this answer from a similar question. Probably won't help OP, but maybe someone like me that had a similar problem.
You should indeed use rvm, but as no one explained to you how to do this without rvm, here you go:
sudo gem install tzinfo builder memcache-client rack rack-test rack-mount
abstract erubis activesupport mime-types mail text-hyphen text-format
thor i18n rake bundler arel railties rails --prerelease --force
add a comment |
For me, something different worked, that I found in on this answer from a similar question. Probably won't help OP, but maybe someone like me that had a similar problem.
You should indeed use rvm, but as no one explained to you how to do this without rvm, here you go:
sudo gem install tzinfo builder memcache-client rack rack-test rack-mount
abstract erubis activesupport mime-types mail text-hyphen text-format
thor i18n rake bundler arel railties rails --prerelease --force
add a comment |
For me, something different worked, that I found in on this answer from a similar question. Probably won't help OP, but maybe someone like me that had a similar problem.
You should indeed use rvm, but as no one explained to you how to do this without rvm, here you go:
sudo gem install tzinfo builder memcache-client rack rack-test rack-mount
abstract erubis activesupport mime-types mail text-hyphen text-format
thor i18n rake bundler arel railties rails --prerelease --force
For me, something different worked, that I found in on this answer from a similar question. Probably won't help OP, but maybe someone like me that had a similar problem.
You should indeed use rvm, but as no one explained to you how to do this without rvm, here you go:
sudo gem install tzinfo builder memcache-client rack rack-test rack-mount
abstract erubis activesupport mime-types mail text-hyphen text-format
thor i18n rake bundler arel railties rails --prerelease --force
answered Jun 11 '18 at 18:30
Seba D'AgostinoSeba D'Agostino
86121526
86121526
add a comment |
add a comment |
I was getting same error on first command, use this command
sudo gem update --system -n /usr/local/bin
– nitish005
May 3 '18 at 7:00
Bravo @nitish005 !!!
– Alessign
May 24 '18 at 15:33
What is the -n?
– Scott Romack
Nov 20 '18 at 13:58