Use sudo -i switch (simulate initial login) incorporates RVM environment when using RVM. Also chdir into the proper directory since this switch implies using the user home directory.