How to install gem all over the world without sudo using rbenv?

I am using rbenv and I am trying to install sass without success.

So, I installed rbenv via Homebrew , then Ruby 2.2 ( rbenv install 2.2 ) and finally gem install sass , but I couldn’t make sass available on my $PATH .

For a short time, I sudo gem install sass using my system (Yosemite) by default Ruby 2. This put everything in /Library/Ruby/Gems/2.0.0 and everything works, but not in the most desirable way.

Ideally, using rbenv , I should be able to install any version of Ruby and install the gems version in it, and then symbolically attached to /usrl/local/bin .

Any help regarding what could go wrong would be greatly appreciated.

+6
source share
1 answer

Basically the problem was that I did not add rbenv/bin/rbenv to $PATH .

 export PATH="$HOME/.rbenv/bin:$PATH" 

Even better, add this to your .bashrc or .bash_profile to start each session with rbenv .

After that, make sure that:

 eval "$(rbenv init -)" 

To enable pads and auto-complete.

fishshell

For those who use fish, you can do the same:

 if status --is-interactive . (rbenv init - | psub) end 

Now, if you don't like modifying $PATH directly and owning /usr/local/bin , a more elegant solution is symlink with ~/.rbenv/bin/rbenv .

  ln -s ~/.rbenv/bin/rbenv /usr/local/bin 

ruby build

As a final warning, be sure to install ruby-build (a rbenv ) to add the install command to rbenv and you can easily install Ruby versions.)

If you use homebrew , it's just like a pie:

 brew install ruby-build 
+10
source

Source: https://habr.com/ru/post/983406/


All Articles