Help us understand the problem. What is going on with this article?

RubyのGem::FilePermissionErrorを解決する

More than 1 year has passed since last update.

Macでgemをインストールしようとするとなにやらパーミッションエラー。

$ gem install bundler

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

sudoでパーミッションを与えてやる。

$ sudo gem install bundler

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.

また別の場所でパーミッションエラーが出たので、次は保存場所もlocalにしてやる。

$ sudo gem install -n /usr/local/bin bundler

Done installing documentation for bundler after 5 seconds
1 gem installed

できた。

$ bundle init

Writing new Gemfile to ~
NAKKA-K
趣味はリファクタリング。 Laravel, React, Scrum, 筋トレを良くするWebエンジニア。
https://nakka-k.hatenablog.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away