Reputation: 1586
I have been using RVM for a year and a half now.
Had the RVM PATH warning surface from every command invocation, but otherwise RVM was still functioning appropriately. I may have fixed that warning with instructions from this link: StackOverflow - Getting “Warning! PATH is not properly set up” when doing rvm use 2.0.0 --default
This involved putting [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
into one of my bash
-related shell configuration profiles.
Adding that one, or too many of those in the other available files in the call chain, may have lead to this weird (mostly?) aesthetic error: SuperUser - Why am I having / how can I fix this error: “shell_session_update: command not found”
Started getting the RVM PATH error again. I did not think this at the time, but looking back at the problem, I wonder if I had just updated my fish
shell from around 2.2.0 to 2.5.0, which may be causing my further actual PATH errors (not warnings) as well...
Executing rvm reset
did not help.
Executing rvm get stable --auto-dotfiles
seemed to help a current terminal, but not others, even on restart. Decided to reinstall.
Ran rvm implode
. Removed or commented out all of the RVM lines in all of my shell configuration files.
Ran through RVM - Integration - Fish Shell, which is also covered here for StackOVerflow - Can't get RVM to switch rubies, which involves doing some of RVM - Installing RVM - Quick (guided) Install first.
curl -sSL https://get.rvm.io | bash -s stable --rails --with-default-gems="rails haml" --with-gems="hirb"
.rvm
fish
function.rvm default
config to config.fish
.My ruby
executable is the wrong version:
⋊> ~ ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
It is the system ruby, and not the RVM-set version:
⋊> ~ which ruby
/usr/bin/ruby
I have no bundle command:
⋊> ~ which bundle
⋊> ~ bundle
fish: Unknown command 'bundle'
⋊> ~ functions bundle
Thus I cannot use Rails without bundle helping me to install the gem:
⋊> ~ rails
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
My PATH
and GEM_PATH
variables do not seem to update, as can be seen below.
My question would be to ask how to get those variables to update? Something similar to this link: StackOverflow - RVM doesn't set correct gem path
⋊> ~ which rails
/usr/bin/rails
⋊> ~ functions rails
⋊> ~ ⨯
⋊> ~ head /usr/bin/rails
#!/usr/bin/ruby
# Stub rails command to load rails from Gems or print an error if not installed.
require 'rubygems'
version = ">= 0"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
ARGV.shift
end
⋊> ~ which rvm
⋊> ~ ⨯
⋊> ~ ls ~/.config/fish/functions/rvm.fish
/Users/username/.config/fish/functions/rvm.fish
⋊> ~ functions rvm|head
function rvm --description 'Ruby enVironment Manager'
# run RVM and capture the resulting environment
set --local env_file (mktemp -t rvm.fish.XXXXXXXXXX);
# echo "DEBUG: env_file: $env_file"
# This finds where RVM's root directory is and sources scripts/rvm from within it. Then loads RVM in a clean environment and dumps the environment variables it generates out for us to use.
bash -c 'PATH=$GEM_HOME/bin:$PATH;RVMA=$(which rvm);RVMB=$(whereis rvm | sed "s/rvm://");source $(if test $RVMA;then echo $RVMA | sed "s/\/bin\//\/scripts\//";elif test $RVMB; then echo $RVMB | sed "s/rvm/rvm\/scripts\/rvm/"; else echo ~/.rvm/scripts/rvm; fi); rvm "$@"; status=$?; env > "$0"; exit $status' $env_file $argv
# apply rvm_* and *PATH variables from the captured environment
and eval (grep -E '^rvm|^GEM_PATH|^GEM_HOME' $env_file | grep -v '_clr=' | sed '/^[^=]*PATH/s/:/" "/g; s/^/set -xg /; s/=/ "/; s/$/" ;/; s/(//; s/)//')
# needed under fish >= 2.2.0
⋊> ~ bash -c 'which rvm'
⋊> ~ bash -c 'whereis rvm'
⋊> ~ bash -c 'echo ~/.rvm/scripts/rvm;'
/Users/username/.rvm/scripts/rvm
⋊> ~ head /Users/username/.rvm/scripts/rvm
#!/usr/bin/env bash
# rvm : Ruby enVironment Manager
# https://rvm.io
# https://github.com/rvm/rvm
# partial duplication marker dkjnkjvnckbjncvbkjnvkj
# prevent from loading in sh shells
if
builtin test -n "${BASH_VERSION:-}" -o -n "${ZSH_VERSION:-}" -o -n "${KSH_VERSION:-}"
⋊> ~ rvm use
Using /Users/username/.rvm/gems/ruby-2.1.5 with gemset ux-rails3.2
⋊> ~ rvm list
rvm rubies
=* ruby-2.1.5 [ x86_64 ]
# => - current
# =* - current && default
# * - default
⋊> ~ ls /Users/username/.rvm/rubies/
default@ ruby-2.1.5/
⋊> ~ ls /Users/username/.rvm/rubies/ruby-2.1.5/
bin/ config include/ lib/ share/
⋊> ~ rvm env
export PATH="/Users/username/.rvm/gems/[email protected]/bin:/Users/username/.rvm/gems/ruby-2.1.5@global/bin:/Users/username/.rvm/rubies/ruby-2.1.5/bin:$PATH"
export GEM_HOME='/Users/username/.rvm/gems/[email protected]'
export GEM_PATH='/Users/username/.rvm/gems/[email protected]:/Users/username/.rvm/gems/ruby-2.1.5@global'
export MY_RUBY_HOME='/Users/username/.rvm/rubies/ruby-2.1.5'
export IRBRC='/Users/username/.rvm/rubies/ruby-2.1.5/.irbrc'
unset MAGLEV_HOME
unset RBXOPT
export RUBY_VERSION='ruby-2.1.5'
⋊> ~ rvm env --path
/Users/username/.rvm/environments/[email protected]
⋊> ~ cat /Users/username/.rvm/environments/[email protected]
export PATH="/Users/username/.rvm/gems/[email protected]/bin:/Users/username/.rvm/gems/ruby-2.1.5@global/bin:/Users/username/.rvm/rubies/ruby-2.1.5/bin:$PATH"
export GEM_HOME='/Users/username/.rvm/gems/[email protected]'
export GEM_PATH='/Users/username/.rvm/gems/[email protected]:/Users/username/.rvm/gems/ruby-2.1.5@global'
export MY_RUBY_HOME='/Users/username/.rvm/rubies/ruby-2.1.5'
export IRBRC='/Users/username/.rvm/rubies/ruby-2.1.5/.irbrc'
unset MAGLEV_HOME
unset RBXOPT
export RUBY_VERSION='ruby-2.1.5'
⋊> ~ rvm 2.1.5 do rvm env --path
/Users/username/.rvm/environments/ruby-2.1.5
⋊> ~ cat /Users/username/.rvm/environments/ruby-2.1.5
export PATH="/Users/username/.rvm/gems/ruby-2.1.5/bin:/Users/username/.rvm/gems/ruby-2.1.5@global/bin:/Users/username/.rvm/rubies/ruby-2.1.5/bin:$PATH"
export GEM_HOME='/Users/username/.rvm/gems/ruby-2.1.5'
export GEM_PATH='/Users/username/.rvm/gems/ruby-2.1.5:/Users/username/.rvm/gems/ruby-2.1.5@global'
export MY_RUBY_HOME='/Users/username/.rvm/rubies/ruby-2.1.5'
export IRBRC='/Users/username/.rvm/rubies/ruby-2.1.5/.irbrc'
unset MAGLEV_HOME
unset RBXOPT
export RUBY_VERSION='ruby-2.1.5'
⋊> ~ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.14.1
- RUBY VERSION: 2.0.0 (2015-12-16 patchlevel 648) [universal.x86_64-darwin16]
- INSTALLATION DIRECTORY: /Users/username/.rvm/gems/[email protected]
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
- EXECUTABLE DIRECTORY: /Users/username/.rvm/gems/[email protected]/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-16
- GEM PATHS:
- /Users/username/.rvm/gems/[email protected]
- /Users/username/.rvm/gems/ruby-2.1.5@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
⋊> ~ gem list
bigdecimal (1.2.0)
bundler (1.7.6)
bundler-unload (1.0.2)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
hirb (0.7.3)
io-console (0.4.2)
json (1.7.7)
minitest (4.3.2)
psych (2.0.0)
rake (0.9.6)
rdoc (4.0.0)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
test-unit (2.0.0.0)
⋊> ~ rvm gemset list
gemsets for ruby-2.1.5 (found in /Users/username/.rvm/gems/ruby-2.1.5)
(default)
global
=> ux-rails3.2
⋊> ~ rvm gemset dir
/Users/username/.rvm/gems/[email protected]
⋊> ~ ls /Users/username/.rvm/gems/[email protected]/
bin
cache
environment
wrappers
⋊> ~ ls /Users/username/.rvm/gems/[email protected]/bin/
⋊> ~
⋊> ~ ls /Users/username/.rvm/gems/ruby-2.1.5@global/bin/
bundle
bundler
executable-hooks-uninstaller
ruby_executable_hooks
⋊> ~ ls /Users/username/.rvm/gems/ruby-2.1.5/bin/
haml
ruby_executable_hooks
tilt
⋊> ~ echo $PATH
/usr/local/mysql/bin /usr/local/opt/coreutils/libexec/gnubin /usr/local/opt/findutils/bin /Users/username/bin /usr/local/mysql/bin /usr/local/opt/coreutils/libexec/gnubin /usr/local/opt/findutils/bin /Users/username/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /usr/local/munki /opt/puppetlabs/bin /Applications/Wireshark.app/Contents/MacOS
⋊> ~ echo $GEM_PATH
/Users/username/.rvm/gems/[email protected]:/Users/username/.rvm/gems/ruby-2.1.5@global
⋊> ~ cat .ruby-gemset .ruby-version
ux-rails3.2
ruby-2.1.5
⋊> ~ grep "rvm" .config/fish/config.fish .bashrc .bash_profile .profile .zshrc .mkshrc .zlogin /etc/profile /etc/bashrc
.config/fish/config.fish:# Source: http://stackoverflow.com/questions/18276701/getting-warning-path-is-not-properly-set-up-when-doing-rvm-use-2-0-0-defaul
.config/fish/config.fish:rvm default;
.bashrc:# From running the command 'rvm get head ...'. Needs to be at the bottom, so no other PATH entries can change the order.
.bashrc:# Source: http://stackoverflow.com/questions/18276701/getting-warning-path-is-not-properly-set-up-when-doing-rvm-use-2-0-0-defaul
.bashrc:# export PATH="$PATH:$HOME/.rvm/bin"
.bash_profile:# [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
.profile:# export PATH="$PATH:$HOME/.rvm/bin"
.profile:# [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
grep: .zshrc: No such file or directory
grep: .mkshrc: No such file or directory
grep: .zlogin: No such file or directory
⋊> ~ ls .gemrc
ls: cannot access '.gemrc': No such file or directory
⋊> ~ rvm -v; ruby -v; rails -v; echo "gem version "(gem -v); rake -V; bundle -v;
rvm 1.29.1 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/]
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
gem version 2.0.14.1
rake, version 0.9.6
fish: Unknown command 'bundle'
Mac 10.12.3
iTerm2 3.0.15
fish, version 2.5.0
bash
, but may still apply since the fish
rvm
function uses bash inside: StackOVerflow - Need to Fix PATH in my bashrc File for RVMUpvotes: 3
Views: 1597
Reputation: 1586
So far I have it barely working by making the change from:
grep -E '^rvm|^GEM_PATH|^GEM_HOME'
to:
grep -E '^rvm|^[^=]*PATH|^GEM_HOME'
Not sure what side effects that will cause, but from looking at the rvm.fish
code, that would seem to be missing.
An older version had the ^[^=]*PATH\
term in it, like my system's previous version, and can also be randomly found here: GitHub Gist - ToniRib/rvm.fish
That is for escaping the pipe (|) characters, but I can't see why that is needed inside of single quotes. My fix works specifically without the backslashes, and just plain pipe characters.
I have alternatively tried a patch without the other code such as this one:
and set -xg GEM_PATH (echo $GEM_PATH | sed 's/ /:/g')
and set -xg PATH (echo $GEM_PATH | sed 's/:/ /g') $MY_RUBY_HOME/bin $PATH
I am continuing to add lines to it, but still see various errors. First I needed the "rubies" directory for the correct version of ruby
, then both gem paths modified with spaces for fish
, and still I am having issues, so taking bash
's PATH
environment variable wholesale and letting the rvm
script do its own work is the best I have so far.
Upvotes: 1