Cocoapods安装 Gem升级失败解决方案

在安装Cocoapods时,升级Gem:sudo gem update --system 更新失败,提示提醒无权限

Updating rubygems-update

ERROR:  While executing gem ... (Gem::FilePermissionError)   

        You don't have write permissions for the /usr/bin directory.

由于 /usr/bin 受系统完整性保护,任何人甚至root用户都不能写。但是可以安装在 /usr/local/bin 这个目录下来代替

解决办法:

sudo gem update -n /usr/local/bin --system    

同理 安装Cocoapods、 sass【未验证】

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

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

你可能感兴趣的:(Cocoapods安装 Gem升级失败解决方案)