File permission error when installing gem bundle for ruby - ruby

This is the massage I am getting
IMTIAZs-MacBook-Pro:~ imtiazahmed$ gem install bundle ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory. IMTIAZs-MacBook-Pro:~ imtiazahmed$
Please help me to solve this.
Thanks

Im on macos big sur 11.6 I had to export ruby to my path in the terminal
export PATH="/Users/okerajohnson/.gem/ruby/2.6.0/bin:$PATH"
and even after that regularly typing gem install gem_name still gave me permission error so I have to do
gem install gem_name --user-install

Installing gem or updating RubyGems fails with permissions error

Related

Unable to install gem colorls on mac

i am trying to install colorls on my mac terminal and when running the "gem install colours" command I get the following error
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
I have tried some fixes online but nothing is working. Can anyone help?

installing gem in terminal on Mac gives permissions error

I tried to install a gem with gem install test-unit and get the same error each time.
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

Installing ruby gems Error: operation nor permitted - usr/bin/sprockets

Im trying to get rubymine to work but i always keep getting this error "operation not permitted"
Gabriellas-MBP:~ GabriellaKampe$ gem install rails
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
Gabriellas-MBP:~ GabriellaKampe$ sudo gem install rails
Password:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/sprockets
Gabriellas-MBP:~ GabriellaKampe$
You don't have permission to write to the gemfile directory of your the ruby version that comes bundled with your OS. What you'll have to do is manage your ruby versions using either rbenv or rvm. I will recommend rbenv and you can follow the guide on these links rbenv rails install Mac OS or rbenv rails install Ubuntu

Ruby 2.3.0 gem pg version 0.18.4 install error El Capitan

After "bundle install", I keep getting this error for many times.
Errno::EACCES: Permission denied # rb_sysopen - /Users/daisukeishii/tasca- io/vendor/bundle/ruby/2.3.0/gems/pg-0.18.4/.gemtest
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.
gem install pg keeps giving the same error
-ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
-psql (PostgreSQL) 9.5.0
-Mac El Capitan
-I checked all related posts in stackoverflow but could not solve this.
Tried to uninstall/install PostgreSQL through brew.
Tried to uninstall/install Ruby
Do you have any idea to solve this?
I had problems installing the pg gem and for me this did the trick:
ARCHFLAGS="-arch x86_64" gem install pg
However, looking at your error message it actually seems to be about not having write permissions to the gem directory. Maybe you have tried to install the gem as root with sudo gem install pg and it left behind a directory under your home directory having root as owner instead of your regular user.
Remove the directory using:
sudo rm -rf /Users/daisukeishii/tascaio/vendor/bundle/ruby/2.3.0/gems/pg-0.18.4
And then try installing again using the ARCHFLAGS above.
Note that your post has some sort of copy paste problem in the path so the path in this example might not be correct.
In my case, the pg gem was looking for a PostgreSQL installation in the wrong place, so I runned
bundle config build.pg --with-pg-config=/usr/local/Cellar/postgresql/9.4.5/bin/pg_config
which was where my PostgreSQL installation actually was, and then
bundle install

when install cocoapods get Error?

I try and gem install cocoapods I get an error :
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
what does it mean???
You need to be root to write into /Library, so you need to use sudo, as the instructions tell you:
$ sudo gem install cocoapods

Resources