Skip to content

Instantly share code, notes, and snippets.

@fadookie
Created April 27, 2017 01:48
Show Gist options
  • Save fadookie/97a7c7fa356e8ac7de94991648f28321 to your computer and use it in GitHub Desktop.
Save fadookie/97a7c7fa356e8ac7de94991648f28321 to your computer and use it in GitHub Desktop.
Steam downloader for non mac/linux games on mac/linux
#!/usr/bin/env bash
###
# This script uses SteamCmd to force downloads of games for other platforms.
# First, install SteamCmd from https://developer.valvesoftware.com/wiki/SteamCMD
# Place this script next to steamcmd.sh and make it executable (chmod u+x download_steam_app.sh)
# Finally, set the config to refer to your username. If you are already signed in to steam you should not need to enter a password.
#
# Usage:
# ./download_steam_app.sh <steam_store_url>
# or
# ./download_steam_app.sh <steam_app_id>
#
# Config is below:
###
STEAM_USERNAME='fadookie' # Set this to your steam username
FORCED_PLATFORM_TYPE='windows' # Set this to the platform of the game you are trying to download
DOWNLOAD_ROOT='download' # Set this to a path relative to the working directory where you would like games to be downloaded
### END Config ###
set -o nounset
set -o errexit
set -o pipefail
APP_ID="$1"
APP_NAME="$APP_ID"
if [[ "$1" == http* ]]; then
# Extract app id and name from provided url
APP_ID=$(echo "$1"|cut -d'/' -f5)
APP_NAME=$(echo "$1"|cut -d'/' -f6)
fi;
set -x
./steamcmd.sh +@sSteamCmdForcePlatformType "$FORCED_PLATFORM_TYPE" +login "$STEAM_USERNAME" +force_install_dir "$DOWNLOAD_ROOT/${APP_NAME}_${APP_ID}" +app_update "$APP_ID" validate +quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment