Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"You don't have [PATH ]in your PATH, gem executables will not run." while using "gem install --user-install bundler"

Tags:

ruby

rubygems

I was trying to install jekyll in my Mac and got the warning as following:

WARNING: You don't have /Users/Carrot/.gem/ruby/2.3.0/bin in your PATH, gem executables will not run.

I checked through gem list and it shows it is installed; and I can find the jekyll through the path "/Users/Carrot/.gem/ruby/2.3.0/bin". I read a post which seems like my situation. I would like to know if it's a must to go through sudo? I now prefer to uninstall everything (since it also installed sass and bunch of things at the same time) and go through homebrew. How can I do the uninstallation?

Many thanks!

like image 985
dragonfly Avatar asked Dec 30 '18 16:12

dragonfly


3 Answers

For those who have problems with @lamech-desai answer, (actually, when they do Desai's commands, it apparently works temporarily for them). So you can easily do these:

open ~/.bshrc if you would like to use bash or ~/.zshrc if your are using zsh or etc...

$ sudo nano .bashrc    ## bash users
$ sudo nano .zshrc     ## zsh users

then copy and past these two lines of codes at the end of the .*rc file:

export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
export PATH="$PATH:$GEM_HOME/bin"

then simply press ctrl+s and ctrl+x. This will save the changes to .bashrc but you won't see them immediately - directly on your next shell login with your current user. One way to see the changes immediately is to switch user to root with su root and then switch back to your previous user with su <username> - and voila, your .bashrc will be reloaded. You can also check this with echo $PATH.

Thanks to @lamech-desai for great answer

like image 117
qafoori Avatar answered Oct 30 '22 03:10

qafoori


If you are using arch linux just use the commands below in your terminal

[user~]$ export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
[user~]$ export PATH="$PATH:$GEM_HOME/bin"
[user~]$ gem list
[user~]$ gem update
like image 12
Lamech Desai Avatar answered Oct 30 '22 03:10

Lamech Desai


You need to add the directory to your PATH environment variable

https://askubuntu.com/questions/406643/warning-you-dont-have-a-directory-in-your-path-gem-executables-will-not-run

like image 7
Palsri Avatar answered Oct 30 '22 02:10

Palsri