ZSH complains about RVM __rvm_cleanse_variables: function definition file not found
Running the following solved the problem:
rm ~/.zcompdump*
Note: The * is incase there are multiple .zcompdump files.
in mac always getting zsh: command not found:
It's evident that you've managed to mess up your PATH
variable. (Your current PATH
doesn't contain any location where common utilities are located.)
Try:
PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
export PATH
Alternatively, for "resetting" zsh, specify the complete path to the shell:
exec /bin/zsh
or
exec /usr/bin/zsh
Why does ZSH return Command not found error for my RVM gems?
check your rc files
- .zshenv
- .zshrc
- .zlogin
- .zprofile
most likely in one of those PATH
is reset after RVM was sourced
also some oh-my-zsh plugins can break stuff, try disabling them and enabling one by one.
theme_precmd:1: vcs_info: function definition file not found For Oh-my-zsh
Be sure to have the package 'zsh-vcs' installed.
apk add zsh-vcs
I had the same error, after some research I have found that you must look at the FPATH variable to check where the zsh function are located.
echo $FPATH
... :/usr/share/zsh/5.7.1/functions/VCS_Info: ...
and this folder didn't exist on my disk !
if you search on alpine packages website the folder, you can see that it exist in the package 'zsh-vcs'.
zsh: reload:4 = not found for function named reload
To explain the error message:
You have the line
if[REPLY == ""] then
According to the parsing rules of zsh, a line such as A B C
is broken on the spaces (with respect to quoting, of course), and the first word (i.e. A
) is taken as a command to execute, while the other words are the parameters. In your case, breaking on the spaces yields the 4 words
if[REPLY
==
""]
then
First, we see that you most likely don't have a command named if[REPLY
. This by itself would already be an error, but zsh bails out earlier: Before it can even try to run the command, it has to prepare the parameters:
The first parameter is ==
, and parameters starting with an =
sign undergo special expansion in zsh: For a word =foo
, the shell tries to locate an executable named foo
and replaces the word by the absolute path to this executable. You can try this out by typing echo =cat
, which will output something like /usr/bin/cat. In your case, what follows after the =
sign, is another =
sign. zsh therefore tries to find a program named =
in your path, and is unsuccessful with it. This is the cause of the error message.
If you had written instead
if [[ $REPLY == "" ]]; then
the shell would have recognized that you have an if
(which is a syntactic construct). After the if
, it expects a command. [[ ... ]]
is an internal command for evaluating certain types of expressions, and inside this construct, different parsing rules apply. For this reason, ==
does not undergo the expansion process described before, but is understood as an operator for testing equality.
BTW, A more idiomatic way would be to write
if [[ -z $REPLY ]]; then
RVM + ZSH + OSX Problems
These scripts use a lot of advanced bash features. Zsh has a lot of them, but some work slightly differently despite having the same syntax, and others have different syntax. It's possible to write scripts that work in both shells, but that requires care and constant testing.
As it happens, the author just fixed this particular bug:
commit d7005e0dbb37964e42ead68551a03b7646c473fc
Author: Conrad Irwin
Date: Sat Feb 26 19:48:30 2011 -0800Rename $path to $target in __rvm_rm_rf
Using $path overrides the global $path variable under zsh.
Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com>
If you run into other issues, take it up with the author. Maintaining scripts that work in both bash and zsh is a lot of work, so it's a matter of whether he's prepared to do this work, perhaps with your assistance as a tester.
Related Topics
Rails 3 Translations Within Models in Production
Devise 'Find_First_By_Auth_Conditions' Method Explanation
How to Merge Two Equally Sized Arrays into One Array with Sub-Arrays of Merged Values
Vps Apache Config - Invalid Command 'Passengerdefaultruby' After Adding Latest Passenger Gem
Instantiate Capybara Browser and Set a Proxy
How to Convert a Large Gem to Standalone Rails App
How to Fix My Cucumber Expectation Error When Polling
How to Link to a Nested Route Path Inside a Loop
Prawn Gem: How to Create the .Pdf from an *Existing* File (.Xls)
Ruby on Rails Group_By (How to Group Events by Month)
Rspec Controller Testing - Blank Response.Body