How to set up path for gems with the Fish shell?

梦想的初衷 提交于 2019-12-11 04:25:17

问题


How do I properly set up path for gems with the Fish shell?

sanoy@nice-system ~/D/c/h/bellevue> gem install bundle

WARNING: You don't have /home/sanoy/.gem/ruby/2.2.0/bin in your PATH, gem executables will not run. Successfully installed bundle-0.0.1 Parsing documentation for bundle-0.0.1 Done installing

documentation for bundle after 0 seconds 1 gem installed

sanoy@nice-system ~/D/c/h/bellevue> bundle install fish: Unknown command 'bundle'

config.fish file

set PATH </home/sanoy/.gem/ruby/2.2.0/bin> $PATH

set -gx PATH $PATH </home/sanoy/.gem/ruby/2.2.0/bin>

回答1:


As discovered in comments, leaving single line in fish.config fixes the problem:

set -gx PATH ~/.gem/ruby/2.2.0/bin $PATH



回答2:


It is likely better to use a dynamically updated path based on version, especially if version updates without distro updates like in Arch Linux

set -U fish_user_paths (ruby -e 'print Gem.user_dir')/bin $fish_user_paths


来源:https://stackoverflow.com/questions/31801840/how-to-set-up-path-for-gems-with-the-fish-shell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!