I’ve just been cleaning up my zshell config files. I noticed that the following lines were at the end of both my .zshrc
and .zprofile
files:
# Add RVM to PATH for scripting [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
I’m not sure how I got into that situation, but this duplication was an itch which had to be scratched.
Removing this from .zshrc
gives the following error when trying to use rvm:
Warning! PATH is not properly set up, '/Users/duncanstuart/.rvm/gems/ruby-2.0.0-p247/bin' is not at first place, usually this is caused by shell initialization files - check them for 'PATH=...' entries, it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles', to fix temporarily in this shell session run: 'rvm use ruby-2.0.0-p247'.
This is fair enough: for reasons I don’t fully understand, rvm needs a bunch of paths to be at the very beginning of PATH – that’s why the lines in question need to be at the end of the .zshrc
file. Looking at my path (echo $PATH
), those paths are in the middle somewhere – presumably being added by .zprofile
. No good.
On the other hand, removing this from .zprofile
gave me a couple of errors from rvm on opening a new terminal:
/Users/duncanstuart/.rvm/scripts/initialize:42: __rvm_cleanse_variables: function definition file not found
…and also something like curl (6) Couldn't resolve host 'rubygems.org'
(I’ve lost that actual error message).
A search on stackoverflow suggested the thing to do was to remove ~/.zshcompdump
As far as I can understand from the zshell docs, this is something to do with autocompletion:
To speed up the running of
compinit
, it can be made to produce a dumped configuration that will be read in on future invocations; […] The dumped file is.zcompdump
in the same directory as the startup files
Fine – sounds very deletable. And indeed, deleting it removes the errors, so I can happily leave those lines out of my .zprofile
. Also, as expected, a fresh .zcompdump
got generated.
One final thing: I noticed that opening a new terminal was taking slightly longer than before. Compiling the new .zcompdump
seems to shave off a couple of milliseconds and makes it feel nice and responsive again:
% zcompile .zcompdump
One reply on “Removing duplicated rvm lines from zsh config files”
Thnaks, removing the .zcompdump files resolved an issue I was having that was throwing “command not found: __rvm_cleanse_variables”