mas-cli / mas

:package: Mac App Store command line interface
MIT License
10.89k stars 274 forks source link

Install old versions of apps #392

Open Red1860 opened 3 years ago

Red1860 commented 3 years ago

Is your feature request related to a problem? Please describe. I was wondering if it is possible to downgrade apps downloaded from the app store using mas. (If the older versions of the app have been downloaded/linked to the apple id)

Describe the solution you'd like If all the app updates are linked to the apple id then maybe mas can install them using something like a install-old version command

I don't know if it would be possible though.

chris-araman commented 3 years ago

I don't know that this will be possible. The App Store is focused on getting the current version of apps to users. I'm not aware of a way to query it for previous versions.

If it's something that the App Store app (the GUI) can do, then it might be possible for mas to do. I don't think the App Store app provides a way for users to install old versions of an app, only the most current version.

phatblat commented 3 years ago

I'm also doubtful that this is possible. Does the Mac App Store offer installation of an older version of an app when the latest/current version of the app requires a higher version of macOS than is currently installed? I know that's how iOS app installs work. I'm wondering if there's an API for these older versions, but it might not be exposed to us.

phatblat commented 3 years ago

FYI, #386 is a request to "pin" apps so that they are not upgraded the latest version by mas. I know that is different than this request, but it relates versions of apps.

Red1860 commented 3 years ago

I'm also doubtful that this is possible. Does the Mac App Store offer installation of an older version of an app when the latest/current version of the app requires a higher version of macOS than is currently installed?

Yes it does. So for eg, i'm on Catalina and Latest version of Xcode requires Big Sur. I just run the mas command for installing Xcode on Catalina and it prompts me whether i want to download an old version of the app or not and it downloads fine after that. So i'm guessing it all has to do with the Specific id of the App.

As far as on iOS, you can downgrade your apps via jailbreak but you require the app version's id that you want to downgrade to. For eg, if you want to downgrade snapchat you just find your bundle id from here to downgrade to a specific version.

Unfortunately i wasn't able to find any mac apps from that website but I believe thats how it works for Mac App Store too but i'm not sure though.

phatblat commented 3 years ago

Good to know. It may be possible to use that version ID if we can figure out how to get it and find the macOS API for specifying it. mas is already using private APIs to install and upgrade apps.

jankais3r commented 2 years ago

I made a naive attempt and I hardcoded an appExtVrsId belonging to an older app version in Sources/MasKit/AppStore/SSPurchase.swift, but that lead to an error on download. Turns out, not all API endpoints allow setting that value, as discussed here.

The solution applied by ipatool-py to allow downloading older version of (iOS) apps is to install the last Windows version of iTunes that bundled the App Store functionality and hook into it with Frida to sniff the kbsync token needed for interaction with appExtVrsId-enabled API endpoints. As of right now, Frida doesn't work very well on Monterey, so possibly similarly convoluted approach would likely have to be deployed here.

txthinking commented 1 year ago

I have done this using brook, the script inside is available for reference, download older versions of any iOS app: https://www.txthinking.com/talks/articles/ios-old-version-app-en.article