rbenv Your user account isn't allowed to install to the system Rubygems

时间:2022-02-20 13:40:35

Clone一个新Rails项目到Mac, bundle install 的时候遇到下面的提示

Fetching source index from http://rubygems.org/ Your user account isn't allowed to install to the system Rubygems. You can cancel this installation and run: bundle install --path vendor/bundle to install the gems into ./vendor/bundle/, or you can enter your password and install the bundled gems to Rubygems using sudo. Password:

也就是说,rbenv 要往你系统的自带Ruby里面安装gem.

gem list | grep bundler

用上面的命令看看你是否通过rbenv安装了bundler. 如果没有那就对了,所以只能去找系统的ruby了,那么你可能不希望这样。

所以解决办法已经明了:

gem install bundler
rbenv rehash