From man su
,
-, -l, --login Provide an environment similar to what the user would expect had the user logged in directly.
So with su - app
, after switch to the user app
, you end up in the user’s HOME directory,
and have the user’s ~/.bash_profile
(not ~/.bashrc
) executed.
Tools like RVM need a “login shell”.
RVM by default adds itself currently to ~/.bash_profile file
So if use su app
, RVM will not be ready there for you after su
.