Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 1347 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to install a gem or update RubyGems if it fails with a permissions error

#31
Try [nathanwhy's answer][user-install] before using my original answer below. His recommendation of `--user-install` should accomplish the same purpose without having to muck with your `.bash_profile` or determine your Ruby version.

----

If you are not concerned about a specific ruby version, you can skip the [heavy-lift Ruby environment manager options][heavy], and just add these lines to `~/.bash_profile`:

``` sh
export GEM_HOME="$HOME/.gem/ruby/2.0.0"
export GEM_PATH="$HOME/.gem/ruby/2.0.0"
```

The path is stolen from the original output of `gem env`:

``` yaml
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.14
- RUBY VERSION: 2.0.0
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.0.0
- RUBY EXECUTABLE: /System/Library/.../2.0/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-14
- GEM PATHS:
- /Library/Ruby/Gems/2.0.0
- /Users/mylogin/.gem/ruby/2.0.0 # <---- This line, right here. -----
- /System/Library/.../usr/lib/ruby/gems/2.0.0
...
```

No `sudo`ing is required, and you can use the already-installed Ruby, courtesy of Apple.

[heavy]:

[To see links please register here]

[user-install]:

[To see links please register here]

Reply

#32
> ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.6.0

[2022 Solution]
The detailed reason for the issues has been added [here][1]

Summary of the issue -> The issue was related to ruby access, M1 MAC comes with its own ruby. We don't have permission to use that for our purpose. Instead, we install a separate instance of ruby and use it for our purpose.

The below steps helped me resolve the problem, hope this might help some

> We don't need to install ruby with rvn or chruby.
> My solution uses homebrew to install ruby.

1. Open the terminal

2. Install ruby using homebrew

>[for fresh install] `brew install ruby`

>[for reinstalling] `brew reinstall ruby`

3. Check the path of ruby using the below command

`which ruby`

4. It should be installed in the below path

`/usr/bin/ruby`

5. To change the ruby path to the user path

To check which shell is used by your system

echo $0

-zsh


>For zshrc

`echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >>~/.zshrc`

>For bash

`echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >>~/~/.bashrc`

6. Quit and relaunch the terminal


7. After changing the path with step 5

8. Check for the path of the ruby again (execute step 3 - please make sure the path displays as given below)

`/usr/local/opt/ruby/bin/ruby`

>[if you don't quit and launch the terminal, step 4 path will be shown]

9. This step may not be applicable to everyone can skip step 10 & 11, if you have the correct Cocoapods version installed

Check the version of the pod installed

`pod --version`

10. Uninstall the specific version of Cocoapods using the below command

>In case the version installed is 1.11.0

`gem uninstall cocoapods -v 1.11.0`

11. Install the Cocoapods of the specific version

gem install cocoapods -v 1.11.0


12. Change the path to the Project directory cd {path of the project directory}

13. Install the bundler in the project directory

`bundle install`

14. Execute pod install

`pod install`


[1]:

[To see links please register here]

Reply

#33
Steps to resolve issue:

Step 1: check and install cocoapods with home brew

brew install cocoapods

Step 2: This is most important, to resolve all the issues, installing
rvm package with stable ruby version, without this you will be
accessing ruby version inside System folder where you don't have
permission.

\curl -sSL

[To see links please register here]

| bash -s stable --ruby

Step 3: Add rvm command path to .zshrc file to access it globally

export PATH="$PATH:$HOME/.rvm/scripts/rvm"

Step 4: check if rvm is running properly inside command line globally

rvm --version

Step 5: Now you can install cocoapods package inside user bin as this will
access ruby file from rvm folder, without any permission needed.

sudo gem install -n /usr/local/bin cocoapods

Step 6: Now you can check pod also by using below command

pod install
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through