Skip to content

Instantly share code, notes, and snippets.

@fernandolopez
Last active December 14, 2020 19:50
Show Gist options
  • Save fernandolopez/6431624 to your computer and use it in GitHub Desktop.
Save fernandolopez/6431624 to your computer and use it in GitHub Desktop.
Install RVM without sudo
#!/bin/bash
# Change this:
RUBY_VERSION=1.9.3
echo "su -c apt-get install curl"
while ! su -c apt-get install curl; do
true
done
curl -L https://get.rvm.io | bash -s stable --autolibs=read-fail
if ! grep 'source $HOME/.bash_profile' ~/.bashrc; then
echo 'source $HOME/.bash_profile' >> ~/.bashrc
fi
source ~/.profile
rvm autolibs read-fail
deps=$(rvm install $RUBY_VERSION 2>&1 | grep "Missing required
packages" | cut -d: -f2 | tr ',' ' ' | tr -d '.')
if [ -z "$deps" ]; then
echo "RVM don't require other packages to install Ruby $RUBY_VERSION"
else
echo "Missing packages"
echo "su -c \"apt-get install $deps\""
while ! su -c "apt-get install $deps"; do
true
done
rvm install $RUBY_VERSION
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment