Skip to content

Instantly share code, notes, and snippets.

@johand
Created August 21, 2013 22:51
Show Gist options
  • Save johand/6301241 to your computer and use it in GitHub Desktop.
Save johand/6301241 to your computer and use it in GitHub Desktop.
heroku toolbelt installer without sudo
HEROKU_CLIENT_URL="http://assets.heroku.com.s3.amazonaws.com/heroku-client/heroku-client.tgz"
echo "This script requires superuser access to install software."
echo "You will be prompted for your password."
su -c "sh <<SCRIPT
# download and extract the client tarball
rm -rf /usr/local/heroku
mkdir -p /usr/local/heroku
cd /usr/local/heroku
if [[ -z "$(which wget)" ]]; then
curl -s $HEROKU_CLIENT_URL | tar xz
else
wget -qO- $HEROKU_CLIENT_URL | tar xz
fi
mv heroku-client/* .
rmdir heroku-client
ln -sfn /usr/local/heroku/bin/heroku /usr/bin/
SCRIPT"
# remind the user to add to $PATH
if [[ ":$PATH:" != *":/usr/local/heroku/bin:"* ]]; then
echo "Add the Heroku CLI to your PATH using:"
echo "$ echo 'PATH=\"/usr/local/heroku/bin:\$PATH\"' >> ~/.profile"
fi
echo "Installation complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment