Last active
September 12, 2021 00:34
-
-
Save mzpqnxow/4a051d8659309cf271b0c80f39e5d1d1 to your computer and use it in GitHub Desktop.
Automatically download and install latest version of PyCharm (Community or Professional) for linux without wasting your time in a browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This will download the latest Linux version of PyCharm, a tarball that works on Debian, Ubuntu, Fedora, etc, etc... | |
# You can just paste it into your terminal, put it in a shell script and execute it, our simply source it. | |
# | |
# - AG | |
# | |
# (Edited multiple times for quotes and other silly things) | |
# | |
# Dependencies: | |
# - wget | |
# - jq | |
# - bash | |
# | |
# Debian: | |
# $ sudo apt-get update && sudo apt-get -y install jq wget | |
# RHEL / Fedora/ CentOS: | |
# $ sudo yum install wget jq | |
# Arch: | |
# $ sudo pacman -S wget jw | |
# | |
# TO futureproof this a little, you may want to change the tar -xvf bit to use 7z as it will know what to do in the event | |
# that PyCharm is moved from being a tar file. This is really supposed to be a one-liner, not a shell script, so I am not | |
# adding logic on how to to handle different compressed filetypes, or doing any other validation, though '&&' is used as | |
# much as possible to detect failures, halt, then catch fire in a clean way :> | |
# | |
export EDITION=PCC # PCC = Community, PCP == Professional | |
export TMPNAME=pycharm-${EDITION}-latest.tar | |
export PREFIX=/opt # Change to ~/ if you want | |
export SUDO=sudo # Change to SUDO= if you are installing to your home directory, if installing to /opt us SUDO=sudo | |
export QUIET= # Change to QUIET=-q if you want wget to be quiet, other leave it for status | |
pushd ~ && \ | |
curl -s -L "https://data.services.jetbrains.com/products/releases?code=${EDITION}&latest=True" | \ | |
jq ".${EDITION} | map(.downloads) | map(.linux) | map(.link)[0]" | \ | |
xargs -L 1 wget ${QUIET} -O ${TMPNAME} && \ | |
${SUDO} tar -C "${PREFIX}" -xvf "${TMPNAME}" && \ | |
rm -f "${TMPNAME}" && \ | |
echo "Installed to ${PREFIX} && \ | |
echo && \ | |
echo "Add the following to your PATH: ${PREFIX}/$(ls -lrt ${PREFIX} | tail -1 | awk '{print $9}')/bin && \ | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment