I recently wanted to completely uninstall nvm
and reinstall it, and get rid of any of its environments. Turns out that getting rid of it does not seem to because much of nvm
is in part implemented as a boatload of shell functions that are sourced into your shell via .bash_profile
or .bashrc
, or wherever you added those sourcing commands it told you to when you first installed it.
Baffled at first by which nvm
returning nothing yet clearly the nvm
command and others were still being found, I eventually discovered via declare -F
that it's a bunch of shell functions. I didn't want to just kill the shell and start a new one (for reasons not relevant here), so I cleared nvm
functions out of that shell with this:
for F in `declare -F | grep -e nvm | cut -f 3 -d\ `; do unset -f $F; done
Some variations on that might be helpful to someone out there that for whatever reason wants to do something similar and can't restart a new shell or doesn't want to.
unfunction
would be a nice name for a command :-)