Error occurred when installing software via gem in MacOS:
ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
- MacOS’s built-in Ruby requires access to system directories, which has insufficient permissions.
- In order to keep the built-in Ruby in MacOS without affecting Ruby development, you can install an additional Ruby.
Version of built-in Ruby in MacOS
ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin21]
Version of Ruby installed via brew
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin21]
Installing Software Packages
- Use the gem installed via brew to install software packages
3.2.2_1: Version of Ruby installed via brew
<name>: Name of the software package
/opt/homebrew/Cellar/ruby/3.2.2_1/bin/gem install <name>
Location of Software Packages
- Software installed via gem installed via brew may be stored in the directory at the same level as gem.
In this case, sass was installed using gem installed via brew.
- It may also be located in the
CSDN - Mr.时光流年
CSDN - sepier