ruby - How to install gems without sudo on Mac OS X -


i've read numerous posts none far has done trick.

how can i, on osx (el capitan beta) install gem own user? posts suggest specifying -user-install example cannot call gem without sudo @ throws permission errors.

i followed "install gem user on osx 10.10 yosemite" still cannot call gem.

i installed homebrew, installed rbenv per above guide, installed version of ruby rbenv, checked loaded correctly, final step in guide call gem install still cannot do.

calling gem after installing rbenv results in:

/users/me/.rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/stub_specification.rb:71:in `initialize':  permission denied @ rb_sysopen - /users/ne/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/speci 

rbenv env dump:

rbenv_version=2.1.5 rbenv_root=/users/me/.rbenv rbenv_hook_path=:/users/me/.rbenv/rbenv.d:   /usr/local/etc/rbenv.d:   /etc/rbenv.d:   /usr/lib/rbenv/hooks path=/users/me/.rbenv/versions/2.1.5/bin:   /usr/local/cellar/rbenv/0.4.0/libexec:   /users/me/.rbenv/plugins/rbenv-env/bin:   /users/me/.rbenv/shims:   /usr/local/heroku/bin:   /usr/local/sbin:   /usr/local/bin:   /usr/local/share/npm/bin:   /applications/atom.app/contents/resources/app/apm/bin:   /users/me/.bin:   /applications/atom.app/contents/resources/app/apm/node_modules/atom-package-manager/bin:   /usr/local/bin:/usr/bin:   /bin:   /usr/sbin:/sbin:   /opt/x11/bin:   /usr/local/macgpg2/bin rbenv_dir=/users/me/.rbenv/plugins 

"brew , gem both throws 'permission denied' error whenever run it" seems related though not solved except using other method may have do.

if can't use gem without sudo, sounds haven't initialized rbenv correctly because shims aren't available.

these steps the documentation. confirm did them all:

add ~/.rbenv/bin $path access rbenv command-line utility.

$ echo 'export path="$home/.rbenv/bin:$path"' >> ~/.bash_profile 

ubuntu desktop note: modify ~/.bashrc instead of ~/.bash_profile.

zsh note: modify ~/.zshrc file instead of ~/.bash_profile.

add rbenv init shell enable shims , autocompletion.

$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile 

same in previous step, use ~/.bashrc on ubuntu, or ~/.zshrc zsh.

restart shell path changes take effect. (opening new terminal tab it.) check if rbenv set up:

$ type rbenv #=> "rbenv function" 

Comments