diff --git a/rc/bashrc b/rc/bashrc index 1162c70f..a5827c46 100644 --- a/rc/bashrc +++ b/rc/bashrc @@ -189,6 +189,11 @@ fi # Sets PATH. To add another path, add : to string below. PATH=$HOME/.local/bin:$HOME/.local/sbin:$HOME/.local/games:$HOME/bin:$HOME/sbin:$HOME/games:/usr/local/bin:/usr/local/sbin:/usr/local/games:/usr/bin:/usr/sbin:/usr/games:/bin:/sbin:/games:$PATH +# Add RubyGems to PATH +if hash ruby 2>/dev/null; then + PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH" +fi + # Removes duplicates from $PATH. Copied from http://unix.stackexchange.com/a/14896 PATH=$(echo "$PATH" | awk -v RS=':' -v ORS=":" '!a[$1]++{if (NR > 1) printf ORS; printf $a[$1]}') diff --git a/rc/zshrc b/rc/zshrc index ea33f218..f3291f4a 100644 --- a/rc/zshrc +++ b/rc/zshrc @@ -133,6 +133,11 @@ fi # Sets PATH. To add another path, add : to string below. PATH=$HOME/.local/bin:$HOME/.local/sbin:$HOME/.local/games:$HOME/bin:$HOME/sbin:$HOME/games:/usr/local/bin:/usr/local/sbin:/usr/local/games:/usr/bin:/usr/sbin:/usr/games:/bin:/sbin:/games:$PATH +# Add RubyGems to PATH +if hash ruby 2>/dev/null; then + PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH" +fi + # Removes duplicates from $PATH. Copied from http://unix.stackexchange.com/a/14896 PATH=$(echo "$PATH" | awk -v RS=':' -v ORS=":" '!a[$1]++{if (NR > 1) printf ORS; printf $a[$1]}')