Installing Ruby gem without using `sudo`
up vote
0
down vote
favorite
The following Ruby gem installation without sudo used to work back in the day:
xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
export PATH=/usr/local/bin:$PATH
launchctl setenv PATH “/usr/local/bin:$PATH”
brew install ruby
gem install jekyll
But now on the last step, I get:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
I have tried this solution - https://gist.github.com/DirtyF/5d2bde5c682101b7b5d90708ad333bf3. And, it sort of worked, but now my $PATH is messed up. echo $PATH returns - /Users/username/.rbenv/shims:/Users/username/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin.
I have fully removed rbenv and cleared .bash_profile. Now my $PATH looks like so /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin what gets me back to the point one:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
Can anyone share a correct up-to-date way to install Ruby gem without using sudo and messing up the $PATH?
macOS 10.14.1
ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.2.3
- RUBY VERSION: 2.3.7 (2018-03-28 patchlevel 456) [universal.x86_64-darwin18]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/username/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /Users/username/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-18
- GEM PATHS:
- /Library/Ruby/Gems/2.3.0
- /Users/username/.gem/ruby/2.3.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
ruby macos path rubygems homebrew
add a comment |
up vote
0
down vote
favorite
The following Ruby gem installation without sudo used to work back in the day:
xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
export PATH=/usr/local/bin:$PATH
launchctl setenv PATH “/usr/local/bin:$PATH”
brew install ruby
gem install jekyll
But now on the last step, I get:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
I have tried this solution - https://gist.github.com/DirtyF/5d2bde5c682101b7b5d90708ad333bf3. And, it sort of worked, but now my $PATH is messed up. echo $PATH returns - /Users/username/.rbenv/shims:/Users/username/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin.
I have fully removed rbenv and cleared .bash_profile. Now my $PATH looks like so /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin what gets me back to the point one:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
Can anyone share a correct up-to-date way to install Ruby gem without using sudo and messing up the $PATH?
macOS 10.14.1
ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.2.3
- RUBY VERSION: 2.3.7 (2018-03-28 patchlevel 456) [universal.x86_64-darwin18]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/username/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /Users/username/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-18
- GEM PATHS:
- /Library/Ruby/Gems/2.3.0
- /Users/username/.gem/ruby/2.3.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
ruby macos path rubygems homebrew
what version of MacOS are you on? Are you still trying to use system ruby? I would still recommend using RVM as you should not have any permissions issues with that.
– lacostenycoder
Nov 11 at 11:57
Can you also paste the output offgem env? The error is because whatever you're doing is trying to modify system library directories/files which you can't do withoutsudo. But installing gems withsudois not recommended. Also this thread my give some insight github.com/rbenv/rbenv/issues/1122
– lacostenycoder
Nov 11 at 11:59
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
The following Ruby gem installation without sudo used to work back in the day:
xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
export PATH=/usr/local/bin:$PATH
launchctl setenv PATH “/usr/local/bin:$PATH”
brew install ruby
gem install jekyll
But now on the last step, I get:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
I have tried this solution - https://gist.github.com/DirtyF/5d2bde5c682101b7b5d90708ad333bf3. And, it sort of worked, but now my $PATH is messed up. echo $PATH returns - /Users/username/.rbenv/shims:/Users/username/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin.
I have fully removed rbenv and cleared .bash_profile. Now my $PATH looks like so /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin what gets me back to the point one:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
Can anyone share a correct up-to-date way to install Ruby gem without using sudo and messing up the $PATH?
macOS 10.14.1
ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.2.3
- RUBY VERSION: 2.3.7 (2018-03-28 patchlevel 456) [universal.x86_64-darwin18]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/username/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /Users/username/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-18
- GEM PATHS:
- /Library/Ruby/Gems/2.3.0
- /Users/username/.gem/ruby/2.3.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
ruby macos path rubygems homebrew
The following Ruby gem installation without sudo used to work back in the day:
xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
export PATH=/usr/local/bin:$PATH
launchctl setenv PATH “/usr/local/bin:$PATH”
brew install ruby
gem install jekyll
But now on the last step, I get:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
I have tried this solution - https://gist.github.com/DirtyF/5d2bde5c682101b7b5d90708ad333bf3. And, it sort of worked, but now my $PATH is messed up. echo $PATH returns - /Users/username/.rbenv/shims:/Users/username/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin.
I have fully removed rbenv and cleared .bash_profile. Now my $PATH looks like so /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin what gets me back to the point one:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
Can anyone share a correct up-to-date way to install Ruby gem without using sudo and messing up the $PATH?
macOS 10.14.1
ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.2.3
- RUBY VERSION: 2.3.7 (2018-03-28 patchlevel 456) [universal.x86_64-darwin18]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/username/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /Users/username/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-18
- GEM PATHS:
- /Library/Ruby/Gems/2.3.0
- /Users/username/.gem/ruby/2.3.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
ruby macos path rubygems homebrew
ruby macos path rubygems homebrew
edited Nov 12 at 9:25
asked Nov 10 at 9:14
alljamin
512527
512527
what version of MacOS are you on? Are you still trying to use system ruby? I would still recommend using RVM as you should not have any permissions issues with that.
– lacostenycoder
Nov 11 at 11:57
Can you also paste the output offgem env? The error is because whatever you're doing is trying to modify system library directories/files which you can't do withoutsudo. But installing gems withsudois not recommended. Also this thread my give some insight github.com/rbenv/rbenv/issues/1122
– lacostenycoder
Nov 11 at 11:59
add a comment |
what version of MacOS are you on? Are you still trying to use system ruby? I would still recommend using RVM as you should not have any permissions issues with that.
– lacostenycoder
Nov 11 at 11:57
Can you also paste the output offgem env? The error is because whatever you're doing is trying to modify system library directories/files which you can't do withoutsudo. But installing gems withsudois not recommended. Also this thread my give some insight github.com/rbenv/rbenv/issues/1122
– lacostenycoder
Nov 11 at 11:59
what version of MacOS are you on? Are you still trying to use system ruby? I would still recommend using RVM as you should not have any permissions issues with that.
– lacostenycoder
Nov 11 at 11:57
what version of MacOS are you on? Are you still trying to use system ruby? I would still recommend using RVM as you should not have any permissions issues with that.
– lacostenycoder
Nov 11 at 11:57
Can you also paste the output off
gem env? The error is because whatever you're doing is trying to modify system library directories/files which you can't do without sudo. But installing gems with sudo is not recommended. Also this thread my give some insight github.com/rbenv/rbenv/issues/1122– lacostenycoder
Nov 11 at 11:59
Can you also paste the output off
gem env? The error is because whatever you're doing is trying to modify system library directories/files which you can't do without sudo. But installing gems with sudo is not recommended. Also this thread my give some insight github.com/rbenv/rbenv/issues/1122– lacostenycoder
Nov 11 at 11:59
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
Don't install ruby with homebrew if you are going to use a ruby version manager, i.e. rbevn.
I would at this point recommend brew uninstall ruby
Then use rbenv if you already have it working to install your ruby version.
But if you are confused and not sure what you're doing, you might wanna consider using RVM instead of RBENV as the install/setup is easier.
If so see How do you uninstall rbenv on OSX?
Then see https://rvm.io/rvm/install
Looking at your gist
echo "export PATH=$HOME/gems/bin:$PATH" >> ~/.bashrc
You may need to edit your ~/.bashrc and remove that export line
You will probably want to close and reopen your terminal before doing any of the above. Anything that makes changes to ~/.bashrc won't take effect until you restart your terminal
Thanks for your input! I have updated my question with more details.
– alljamin
Nov 11 at 9:32
add a comment |
up vote
0
down vote
Thanks for the helpful link lacostenycoder. I have managed to get Ruby gems installed without sudo the following way:
xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install rbenv
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
rbenv install 2.5.1
rbenv global 2.5.1
gem install jekyll
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Don't install ruby with homebrew if you are going to use a ruby version manager, i.e. rbevn.
I would at this point recommend brew uninstall ruby
Then use rbenv if you already have it working to install your ruby version.
But if you are confused and not sure what you're doing, you might wanna consider using RVM instead of RBENV as the install/setup is easier.
If so see How do you uninstall rbenv on OSX?
Then see https://rvm.io/rvm/install
Looking at your gist
echo "export PATH=$HOME/gems/bin:$PATH" >> ~/.bashrc
You may need to edit your ~/.bashrc and remove that export line
You will probably want to close and reopen your terminal before doing any of the above. Anything that makes changes to ~/.bashrc won't take effect until you restart your terminal
Thanks for your input! I have updated my question with more details.
– alljamin
Nov 11 at 9:32
add a comment |
up vote
0
down vote
Don't install ruby with homebrew if you are going to use a ruby version manager, i.e. rbevn.
I would at this point recommend brew uninstall ruby
Then use rbenv if you already have it working to install your ruby version.
But if you are confused and not sure what you're doing, you might wanna consider using RVM instead of RBENV as the install/setup is easier.
If so see How do you uninstall rbenv on OSX?
Then see https://rvm.io/rvm/install
Looking at your gist
echo "export PATH=$HOME/gems/bin:$PATH" >> ~/.bashrc
You may need to edit your ~/.bashrc and remove that export line
You will probably want to close and reopen your terminal before doing any of the above. Anything that makes changes to ~/.bashrc won't take effect until you restart your terminal
Thanks for your input! I have updated my question with more details.
– alljamin
Nov 11 at 9:32
add a comment |
up vote
0
down vote
up vote
0
down vote
Don't install ruby with homebrew if you are going to use a ruby version manager, i.e. rbevn.
I would at this point recommend brew uninstall ruby
Then use rbenv if you already have it working to install your ruby version.
But if you are confused and not sure what you're doing, you might wanna consider using RVM instead of RBENV as the install/setup is easier.
If so see How do you uninstall rbenv on OSX?
Then see https://rvm.io/rvm/install
Looking at your gist
echo "export PATH=$HOME/gems/bin:$PATH" >> ~/.bashrc
You may need to edit your ~/.bashrc and remove that export line
You will probably want to close and reopen your terminal before doing any of the above. Anything that makes changes to ~/.bashrc won't take effect until you restart your terminal
Don't install ruby with homebrew if you are going to use a ruby version manager, i.e. rbevn.
I would at this point recommend brew uninstall ruby
Then use rbenv if you already have it working to install your ruby version.
But if you are confused and not sure what you're doing, you might wanna consider using RVM instead of RBENV as the install/setup is easier.
If so see How do you uninstall rbenv on OSX?
Then see https://rvm.io/rvm/install
Looking at your gist
echo "export PATH=$HOME/gems/bin:$PATH" >> ~/.bashrc
You may need to edit your ~/.bashrc and remove that export line
You will probably want to close and reopen your terminal before doing any of the above. Anything that makes changes to ~/.bashrc won't take effect until you restart your terminal
answered Nov 10 at 12:28
lacostenycoder
3,56511226
3,56511226
Thanks for your input! I have updated my question with more details.
– alljamin
Nov 11 at 9:32
add a comment |
Thanks for your input! I have updated my question with more details.
– alljamin
Nov 11 at 9:32
Thanks for your input! I have updated my question with more details.
– alljamin
Nov 11 at 9:32
Thanks for your input! I have updated my question with more details.
– alljamin
Nov 11 at 9:32
add a comment |
up vote
0
down vote
Thanks for the helpful link lacostenycoder. I have managed to get Ruby gems installed without sudo the following way:
xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install rbenv
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
rbenv install 2.5.1
rbenv global 2.5.1
gem install jekyll
add a comment |
up vote
0
down vote
Thanks for the helpful link lacostenycoder. I have managed to get Ruby gems installed without sudo the following way:
xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install rbenv
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
rbenv install 2.5.1
rbenv global 2.5.1
gem install jekyll
add a comment |
up vote
0
down vote
up vote
0
down vote
Thanks for the helpful link lacostenycoder. I have managed to get Ruby gems installed without sudo the following way:
xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install rbenv
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
rbenv install 2.5.1
rbenv global 2.5.1
gem install jekyll
Thanks for the helpful link lacostenycoder. I have managed to get Ruby gems installed without sudo the following way:
xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install rbenv
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
rbenv install 2.5.1
rbenv global 2.5.1
gem install jekyll
answered Nov 12 at 10:43
alljamin
512527
512527
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%2f53237532%2finstalling-ruby-gem-without-using-sudo%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
what version of MacOS are you on? Are you still trying to use system ruby? I would still recommend using RVM as you should not have any permissions issues with that.
– lacostenycoder
Nov 11 at 11:57
Can you also paste the output off
gem env? The error is because whatever you're doing is trying to modify system library directories/files which you can't do withoutsudo. But installing gems withsudois not recommended. Also this thread my give some insight github.com/rbenv/rbenv/issues/1122– lacostenycoder
Nov 11 at 11:59