How to deal with the error ERROR: While executing gem ... (Gem :: FilePermissionError)

This is a workaround for Gem errors that occurred when Re: View was installed.

$ gem install review

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

An error like this is output.

The permission to install gem is not allowed

$ sudo gem install review

I think that you can install it by sudo as above, but this time I want to install it in the user area, so I will explicitly specify ** installation destination (GEM_HOME) ** to avoid the error.

$ mkdir -p $HOME/rubygems
$ export GEM_HOME=$HOME/rubygems
$ export PATH=$GEM_HOME/bin:$PATH

Write these 3 lines in ~ / .zshrc etc. and complete.

There is no trouble due to authority.

reference

[ruby] Install gem in user area-Life.

Recommended Posts

How to deal with the error ERROR: While executing gem ... (Gem :: FilePermissionError)
`bind': Address already in use --bind (2) for 127.0.0.1:3000 (Errno :: EADDRINUSE) How to deal with the error
How to deal with the error yaml.scanner.ScannerError: while scanning for the next token that appeared in Rails environment construction with Docker
[Rails / RSpec] How to deal with element has zero size error
How to deal with 405 Method Not Allowed error in Tomcat + JSP
How to put out the error bundling
How to deal with Precompiling assets failed.
How to find the cause of the Ruby error
[Swift] How to link the app with Firebase
[Laravel] How to deal with out of memory error when composer require [Docker]
How to change the action with multiple submit buttons
Diet program with preprocessor (how to deal with i-appli size)
How to deal with fatal: remote origin already exists.
[Docker environment] How to deal with ActiveSupport :: MessageEncryptor :: InvalidMessage
[Rails] How to deal with URL changes after render
Common problems with WSL and how to deal with them
[Docker + Rails] How to deal with Rails server startup failure
[Docker] How to update using a container on Heroku and how to deal with Migrate Error
How to deal with `Cannot connect to the Docker daemon at unix: /// var/run/docker.sock. Is the docker daemon running?`
[Rails] How to solve the error "undefined method` visit'" when using Capybara with Rspec
How to take a screenshot with the Android Studio emulator
12 Corresponds to the while statement
[With back tricks] How to introduce React to the simplest Rails
How to number (number) with html.erb
How to update with activerecord-import
Check how to set the timeout when connecting with Spring + HikariCP + MySQL and executing SQL
How to deal with Bundler :: Dsl :: DSLError by rewriting gemfile
How to fix Android apps crashing with RenderThread mystery error
With the error Cordova-> Looper.prepare ()
How to deal with different versions of rbenv and Ruby
How to change the file name with Xcode (Refactor Rename)
How to deal with the event that Committee :: InvalidRequest occurs in committee during Rspec file upload test
How to deal with the type that I thought about writing a Java program for 2 years
[Rails] How to introduce kaminari with Slim and change the design
How to create your own Controller corresponding to / error with Spring Boot
Android: How to deal with "Could not determine java version from '10 .0.1'"
I tried to translate the error message when executing Eclipse (Java)
Project facet Java version 13 is not supported. How to deal with
[JQuery] How to preview the selected image immediately + Add image posting gem
[Note] How to restart the Windows container set up with docker-compose
How to solve the unknown error when using slf4j in Java
How to use MinIO with the same function as S3 Use docker-compose
How to use the link_to method
[Rails] How to use gem "devise"
How to scroll horizontally with ScrollView
How to use the include? method
How to get started with slim
How to find the average angle
How to enclose any character with "~"
How to use the wrapper class
How to use mssql-tools with alpine
How to get along with Rails
How to add the delete function
How to start Camunda with Docker
twitter-4 selections of certain errors with Twitter login function created by omniauth gem and how to deal with them
You cannot change the project facet version from a dynamic web module to x.x. How to deal with
How to apply thymeleaf changes to the browser immediately with #Spring Boot + maven
How to interact with a server that does not crash the app
How to decorate the radio button of rails6 form_with (helper) with CSS
How to check before sending a message to the server with Spring Integration
[Docker] How to solve the error function not implemented @ io_fread ~ [Super easy]