Skip to content

Instantly share code, notes, and snippets.

@VityaSchel
Created May 13, 2023 17:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VityaSchel/57a887d680d9f910009669c56561c1a2 to your computer and use it in GitHub Desktop.
Save VityaSchel/57a887d680d9f910009669c56561c1a2 to your computer and use it in GitHub Desktop.
Reset Steam achievements on MacOS without SAM

This took me a while to figure out, so here's all you need to know:

  1. To clear achievement we'll use Steam's client secret console and achievement_clear command
  2. You will need game id (number) and achievement id (string) in order to lock this particular achievement
  3. Since there is no "clear all achievements" command, we will use keyboard simulation to paste a long list of commands to steam console

How to do?

  1. Go to https://steamdb.info/ and find your game (I will use Terraria), then go to https://steamdb.info/app/105600/stats/ and find a table of achievements
  2. Scrap all achievements codes from 1st column into text array. You can use my script, just paste into browser console on steamdb page:
console.log(Array.from(document.querySelectorAll('#js-achievements table tr[id^=achievement]')).map(a => a.querySelector('td:first-child').innerText).join('\n'))
  1. Now open Steam's console by going to steam://open/console. You can just paste this into your browser and allow it to open Steam.
  2. This part is tricky, because you have to execute a lot of commands and running them manually is too slow (I tried). You'll need to use oascript to simulate keystrokes.
  3. First run this line of code in zsh (any terminal) and make sure your terminal has access to System Events and has computer control permission, otherwise it simply won't be able to paste commands and press 'return' key for you:
echo "tell application \"System Events\" to keystroke \"aboba\" & return" | osascript

If you see something like zsh: command not found: aboba then you're good to go! 6. Now all you need to do is use this syntax to insert prepared list to this command:

echo "delay 5\ntell application \"System Events\" to keystroke \"achievement_clear GAMEID ACHIEVEMENTID1\" & return\ntell application \"System Events\" to keystroke \"achievement_clear GAMEID ACHIEVEMENTID2\" & return" | osascript

Then execute it, go fast to steam console, focus on input field and just wait until it's done. If you have no idea what I mean by "inserting prepared list to this command" then use my script below: Paste list of achievements codes (list you generated in 2st step) into below script, run it in any JS environment for example online compiler:

const GAMEID = 'PASTE_GAME_ID_NUMBER_HERE'
const list = `
PASTE YOUR LIST IN PLACE OF THIS LINE. DO NOT TOUCH CODE BELOW
`

const achievements = list.split('\n').filter(Boolean)
const commands = achievements.map(a => (
  `\\ntell application \\"System Events\\" to keystroke \\"${`achievement_clear ${GAMEID} ${a}`}\\" & return\\ndelay 0.1`
))
console.log('\n\n\nPASTE COMMAND BELOW TO YOUR TERMINAL, HIT ENTER, THEN FOCUS ON STEAM\n\n\n')
console.log(`echo "delay 3${commands.join('')}" | osascript`)
console.log('\n\n')

Then grab outputted command, paste into zsh and focus steam's client console field for commands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment