Skip to content

Instantly share code, notes, and snippets.

@vyuh
Last active September 21, 2022 13:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vyuh/031c866fcb35c5ec5f6904e0f7b18d1c to your computer and use it in GitHub Desktop.
Save vyuh/031c866fcb35c5ec5f6904e0f7b18d1c to your computer and use it in GitHub Desktop.
Install heroku without sudo on linux
#!/bin/sh
{
HEROKU_CLIENT_URL="https://s3.amazonaws.com/assets.heroku.com/heroku-client/heroku-client.tgz"
sh <<SCRIPT
# set appropriate HEROKU_DIR env variable
# default is ~/.local/heroku
# download and extract the client tarball
rm -rf "${HEROKU_DIR:=~/.local/heroku}"
mkdir -p "$HEROKU_DIR"
cd "$HEROKU_DIR"
if [ -z "$(which wget)" ]; then
curl $HEROKU_CLIENT_URL | tar xz
else
wget -O- $HEROKU_CLIENT_URL | tar xz
fi
mv heroku-client/* .
rmdir heroku-client
SCRIPT
# remind the user to add to $PATH if they don't already have it
echo "Add the Heroku CLI to your PATH using:"
echo "$ echo 'PATH=\"$HEROKU_DIR/heroku/bin:\$PATH\"' >> ~/.profile"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment