mas: š `mas account` doesn't work on macOS 12 and later
Your Environment
mas version: 1.8.3- macOS version (
system_profiler SPSoftwareDataType -detailLevel mini): 12.0 (21A5522h)
mas Install Method
-
brew install mas(homebrew-core) - [] mas-cli/tap
- []
.pkginstaller from releases - [] Built from source
- Fork/branch: ? (e.g. mas-cli/main)
- Xcode version: 10.?
Describe the Bug
mas account says Iām not signed in, although I am:
Not signed in
Error: Not signed in
To Reproduce
Steps to reproduce the behavior:
- Run
mas account - Make sure App Store has a signed in Apple ID
- Run
mas accountagain
Expected Behavior
Getting no error and being able to use other mas commands that depend on being signed din.
Actual Behavior
Not signed in
Error: Not signed in
Screenshots, Terminal Output
If applicable, add screenshots to help explain your problem.
$ mas account
Not signed in
Error: Not signed in
Additional Context
It stopped working around 2 weeks ago I guess? Maybe it worked with the previous version?
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 30
- Comments: 73 (22 by maintainers)
Commits related to this issue
- š Disable `account` command on macOS 12 Documents #417. — committed to mas-cli/mas by chris-araman 3 years ago
- š Disable `account` command on macOS 12 Documents #417. — committed to mas-cli/mas by chris-araman 3 years ago
- š Disable `account` command on macOS 12 Documents #417. — committed to mas-cli/mas by chris-araman 3 years ago
- š Disable `account` command on macOS 12 Documents #417. — committed to mas-cli/mas by chris-araman 3 years ago
- š Disable `account` command on macOS 12 Documents #417. — committed to mas-cli/mas by chris-araman 3 years ago
- š Disable `account` command on macOS 12 Documents #417. — committed to mas-cli/mas by chris-araman 3 years ago
- work around mas issue https://github.com/mas-cli/mas/issues/417 — committed to benbridts/dotfiles by benbridts 3 years ago
- nix: mas is broken on Monterey Check https://github.com/mas-cli/mas/issues/417 — committed to ahmedelgabri/dotfiles by ahmedelgabri 2 years ago
- fixed issues preventing successful install on m1 mac - .osx script was missing - homebrew cask did not allow for apps installed by other sources, like kandji - mas doesn't work on m1 mac yet: https:/... — committed to glevine/mac-dev-playbook by glevine 2 years ago
- Add checks for macOS version to `account`, `signin` tasks for those subcommands are no longer supported by `mas` on the recent versions of macOS - https://github.com/mas-cli/mas/issues/164 - https:/... — committed to antonalekseev/ansible-collection-mac by antonalekseev 2 years ago
Hi, all!
Youāre in the right place. Efforts toward resolving this issue will be tracked here. @phatblat and I are both volunteer maintainers with obligations apart from
masmaintenance. We are not paid (though I do welcome sponsorship). We do this because we love open source and want to give back to the community. We are alsomasusers.Weāre not aware of a workaround at this time, other than using the App Store app, of course.
As youāre probably aware, Apple has made some changes to the private frameworks
masuses to manage App Store apps on your Mac. Complicating things, theclass-dumptool that was used by the originalmasauthor to generate Objective-C headers from those private frameworks does not support extracting dylibs from a cache, and does not appear to support the x86_64h, arm64, or arm64e architectures. The originalmasauthor is no longer involved in themasorclass-dumpprojects, andclass-dumpappears to have been abandoned.A few things have to happen in order to resolve this issue:
CommerceKit.frameworkandStoreFoundation.framework. @phatblat has already done some investigation toward this effort, but thereās more to do.dsc_extractorcode available from Apple that seems to work well enough for this, but it isnāt (yet?) maintained as a standalone tool. This snippet may have already been built into some third-party tools, so it might not be necessary to publish it as a standalone tool.masfunctionality. This may involve making new calls into these frameworks, or dumping headers for some additional framework(s). This one is the trickiest to estimate effort involved. It could be a one-liner, or it could be very involved, or it could be infeasible.tl;dr: This is going to take time and effort. We welcome any helpful contributions from subject matter experts!
That said, additional reports of
maserrors on Monterey arenāt necessary or helpful right now. Please do try to minimize the noise on this thread while we work to solve the problem. We appreciate it!#428 has been merged, v1.8.5 released, and bottles have been published. This resolves the issue many of us were having on Monterey with
install,lucky, andupgrade.For folks using
brew bundlewithmasdependencies (as I do), you may need to wait for corresponding changes toHomebrew-bundle.I will leave this issue open, as the symptom of
mas accountnot working on Monterey remains.As Monterey has been released, it would be nice if mas supports it (fully).
(I understand it takes a lot of work to play around with private frameworks and fix code for macOS upgrades. Keep up the good work ā mas is a very useful tool!)
I think I have a workaround for the issue preventing
install,lucky, and I thinkupgradefrom working on Monterey in #428. It doesnāt exactly fixaccount, because macOS 12 appears to no longer expose this information, or at least not via the same API. However, I suspect most people following this issue are here for redownloads and upgrades. š¤Getting new headers generated will still be useful to see whatās changed and to see if we can re-enable
accounton macOS 12, or possibly evenpurchaseon macOS 10.15 andsigninon macOS 10.13. Iām hopeful others with more expertise in that area will be able to meet that goal! šI ran across Extracting libraries from dyld_shared_cache and was impressed with his/her understanding of the process. Using https://github.com/zhuowei/dsc_extractor_badly I was able to get a CommerceKit x86_64 binary. Neither class-dump nor Dumper were able to work with it, but IDA Free is able to understand this file.
Iāll try updating the headers manually and then see which new methods might return the active account.
Still not fixed?
Just a quick update on my progress:
Iām giving this project a try: https://github.com/ChiChou/IDA-ObjCExplorer
It was a bit broken on Montereyās
dyld_shared_cacheand the latest IDA, but I was able to hack on it a bit and git it going.Unfortunately, the first thing it tries to resolve, it failed on. It parses
__objc_protolistand for each entry, tries to resolvename,types, andimpl. It wasnāt able to resolve any names. The name pointers look reasonable, but are slightly outside ofCommerceKitās mapped addresses. Iām guessing they point into another library or frameworkās segments? Not sure how protocols work really.Anyway, if my theory is correct, then creating an IDB with all of CommerceKitās dependencies loaded may help. My original IDB only had CommerceKit itself. So, yesterday afternoon I created a new IDB and had IDA load all dependencies. For anyone unfamiliar with loading
dyld_shared_cachein IDA, parsing a library and all its dependencies is non-trivial. The resulting IDB loaded about 500 dylibs and is about 17GB. I let IDA analyze all afternoon and through the night, and itās still going this morning. Hopefully analysis will finish soon and I can try the above plugin again.In the mean time if anyone comes up with an easier/faster way, like a class-dump implementation that runs directly on the shared cache, my feelings wonāt be hurt. Happy to be preempted by better ideas.
Cheers, Zach
Same issue on macOS 12.0.1, 13" MacBook Pro 2020 M1
Managed to get the function list out of IDA free using the āCopy Allā context menu entry.
This still needs additional manual processing to generate usable Objective-C headers.
Maybe file that bug with homebrew-core then? https://github.com/Homebrew/homebrew-core
Unfortunately I canāt share the tool since itās work-related
As for disassembly, Iām using IDA to load the reconstructed dyld_shared_cache, and then disassemble individual dylibs. So, happy to run any IDA python scripts against my IDB and share the results if that helps.
And yeah I filed that bug on Ghidra š
Same problem with Release Candidate - macOS 12.0 Beta (21A5552a)
I havenāt found time to dive into this gist yet, but Iām hoping to do so this week. Hopefully there are enough breadcrumbs here to piece together a plan for the original issue reported here, among others.
Yep!
Option 1 would probably be best in the long run if you were able to publish your IDA scripts as open source. That way, we could try to integrate the functionality directly into
class-dump. If you arenāt able to do so, letās go for the quicker, stop-gap progress of option 2.Great work on this, @zcutlip. I really appreciate the time and effort youāre putting into this, and Iām sure others here do too.
Yeah thatās really cool. This gets us really close. Iāll see if I can clean up the output to be a proper header file.
Very nice work on
ipswIf you have bat installed (brew install bat) you can pipe the output of my tool to:
bat -l m --tabs 0 -p --theme Nord --wrap=never --pager "less -S"to make it look amazing.Okay, think I figured something out. The
dyld_shared_cachehas table of āpreoptimizedā strings for all the libraries bundled in the cache. This is located in thelibobjc.A:__OBJC_ROsegment. It starts out with a table of what appear to be class names, from all across the shared cache. Following that there appears to be a table of selector strings.I believe the
0xE10DC5offset is from the start of that selector string table, which gets us to0x1cb346708:Weāll see if that theory holds true for all the selector strings
I havenāt started
StoreFoundationyet. I have a separate IDB for it. I wanted to get the overall process working first,Iāll check on
CKDownloadDirectory&CKDownloadQueueObserverin my CommerceKit IDB and figure out why they arenāt being dumped.Got ivars going. Hereās a sample
I havenāt looked at properties yet, but ivars werenāt too bad. Hopefully properties will be equally straightforward.
Iām attaching a zip file of all the headers Iāve spit out so far, along with the JSON I spit out from IDA.
Cheers
EDIT: Note, many/most of the headers in the zip file are superfluous, but as mentioned previously, Iām not sure of a way to programmatically filter out the ones that donāt need to be generated. So for now theyāre all in there, and we can work on a better way next.
commercekit.zip
Iām now writing out individual
.hfiles per protocol & class, but Iām now realizing thereās a lot more to it. Iām currently dumping about 90-ish header files from CommerceKit alone, because there are lots of class and protocol structures in the binary that donāt need to be dumpedI studied what
class-dumpdoes, and itās quite sophisticated. It actually builds a dependency graph and then is able to do things like add forward declarations and imports as well as work out what protocols & classes it doesnāt need to dump. I donāt think Iāll be able to get to that level of refinement.My proposals are:
Hereās an example of one of the header files I dumped,
CKAuthenticationSettings.h:I still need to do ivars and a couple other things, but that shouldnāt be too bad.
Cheers
Oh, I think I get the organization. Itās supposed to be one
.hper protocol or class, is that right?No need to apologize. Your expertise, efforts, and time are appreciate.
Slower progress than Iād hoped, but getting closer. I was able to get the IDA plugin Iām working on to mostly resolve all the protocol and class structures.
Where itās currently choking is class & instance method names. Itās able to find the type strings as well as the actual method IMPL
IDA can clearly work these out, as @phatblat as demonstrated. Iāll see if thereās a way to either ask IDA āwhatās the Obj-C method name for this IMPL?ā or somehow parse @phatblatās CSV data.
Regarding typing, this plugin isnāt currently rendering that, but I think the type encoding is well understood, and weāre finding the type strings. So shouldnāt be hard to fix up the output to look like a real objc header.
IDA output attached below ida-output.txt
cheers
@zcutlip Thatās a good question. I havenāt ever looked for these private frameworks on iOS, but that did have an app store first so these low-level frameworks may be used on both platforms.
I havenāt ever used
class-dumpon iOS frameworks. Work I do on that platform is to ship to the App Store so we steer clear of Appleās private stuff.Just a thought: do these frameworks exist on iOS? DyldExtractor (linked above) does a pretty good job of extracting dylibs from iOSās shared cache. Theyāre not actually linkable/usable at run-time but theyāre very complete for static analysis purposes. If
class-dumpgenerally works on iOS libraries, and the frameworks you need exist on iOS, would that be an angle worth looking at? Happy to give it at try.In other news: IDA FINALLY finished analyzing my 17GB IDB tonight. Just manually poking around, it seems like obj-c xrefs that werenāt resolving in the āsingle-moduleā IDB are now resolving in the āI pulled on the thread until the whole sweater unravelledā IDB. Itās a bit late for me to go back down the rabbit hole, but Iāll have a look in the morning, and see what there is to see.
Cheers
Shouldnāt it be marked as ānot workingā on Monterey on brew.sh? Itās confusing and creates unnecessary noise. Sorry for my snark earlier.
Iāll see what I can do. Iām not super familiar with the class-dumping side of it. If thereās something already out there, particularly in python, Iāll see if I can adapt it.
Regarding dyld_shared_cache, here are a couple resources for informational purposes. Neither of these help move the ball down the field, but hopefully they offer a bit of insight into the problem space.
Thereās a project called DyldExtractor which unfortunately doesnāt work on macOS shared caches; itās iOS only. But looking through it can give you some insight into how hard a problem it is to reconstruct the dylibs. Itās a pure python project that does not use
dsc_extractor. It parses the shared cache and attempts to reconstruct the dylibs as faithfully as possible. https://github.com/arandomdev/DyldExtractorAnd hereās a project that essentially
dlopen()sdsc_extractorfrom Xcode to extract individual dylibs from the shared cache. Since it relies on Xcodeāsdsc_extractorit does support the new split format, but that also means it spits out broken dylibs. This doesnāt get you any farther that what @phatblat probably has done, but just linking here as a generally useful tool. https://github.com/keith/dyld-shared-cache-extractorcheers, zach
When you use
dsc_extractorto dump a dylib from the shared cache, it doesnāt really give you a proper dylib. Lots of things get rewritten during the linking process that generates the shared cache, anddsc_extractordoesnāt undo most of that. So, you mostly get a mach-o dylib that, at best, superficially resembles the original, but is mostly broken internally. @phatblat, you probably found lots of broken xrefs in IDA.Iām not sure what the specific issues are with
class-dumpbut I wouldnāt be surprised if thatās part of it.Afaik, IDA still doesnāt support the new dyld shard cache format in Monterey (split across several slices), but I have tooling that allows me to re-join the slices. I can then load it up and disassemble individual dylibs cleanly, for the Apple Silicon version (not the intel version, yet).
I donāt know much about
class-dumpbut if there exists (or someone wants to write) an IDA python script that replicates what it does, I can give it a try and share its output. Or really any IDA script that might give you useful info.Same here (with same macOS Monterey version). I noticed to it stopped working after it updated to Beta 7,
mashad been working on previous betas without issue.