AppstoreExtract - Changes/Update

bsuggett
Contributor II

As of 

macOS 11 (Big Sure) and macOS 12 (Monterey) the appstore extract script doesnt work due to changes in the directory structure and the manifest.plist files not being downloaded.

 

This updated script (v.3.1) resolves this issue and prompts the script use to type in a name to name the PKG and DMG like that of the previous naming convention.

 

https://github.com/blakeusblade/MacAdminHelpers/tree/master/AppStoreExtract

 

 

2 ACCEPTED SOLUTIONS

willsmithcc
New Contributor III

This script isn't working for me on 12.3.1, whether I run as sudo or not:

Screen Shot 2022-04-15 at 3.40.04 PM.png

View solution in original post

Dear All,

I think my instructions are a little lacking so will update them.

It should be noted that this script (v3.1) isn't designed to work using the appstore GUI. Its designed to be used with jamf using self service GUI to deploy an app to capture it. The end result is the same...

 

Step 1. Using jamf webUI, target a "Mac App Store" app to your capture machine. (Make avaliable to self service)
Step 2. Using your capture machine, check Self service that you can see your app
Step 3. Run the script using sudo eg "sudo sh ./AppstoreExtract_v3.1.sh"
Step 4. Click on Install in self service
Step 5. Wait until the app is installed and self service is completed the task
Step 6. Navigate to /Users/Shared/AppStore_Packages/ (There should be a PKG in there)
Step 7. Press any key in the script window to stop the script
Step 8. Name the package 
Step 9. The PKG will be deleted and a DMG containing the PKG will be created

You now have a captured AppStore installer one can deploy out.


I've retested this on fresh installs on both macOS 11.6.8 and macOS 12.5.1 and confirmed that the above steps are working.

Important note (Scripting Writers/Users Only):

When jamf tells the machine to fetch/install something from the appstore, its done using sudo which will change the $DARWIN_USER_DIR_PATH. This is the reason why one MUST execute the script using sudo to use the correct $DARWIN_USER_DIR_PATH variable/path

 

 

View solution in original post

7 REPLIES 7

willsmithcc
New Contributor III

This script isn't working for me on 12.3.1, whether I run as sudo or not:

Screen Shot 2022-04-15 at 3.40.04 PM.png

bsuggett
Contributor II

@willsmithcc 

 

Generally you should use sudo if your using the script to capture from jamf deployable app store app. If your using the actual apple store ie logging into the appstore after launching the app store, use without sudo.

 

I've just test run it again on a clean install of macOS 12.3.1 and is working as expected. It might be an (unclean or existing/messy home directory) that the default permissions have changed maybe... The errors/directories in the screenshot suggest that other things are either running or have been running and might have changed the permissions to the directory structure.

 

You could try creating a new account and trying again or on a clean install of macOS 12 with no changes but to run the script... I genreally always capture on/in clean environments thats just had macOS installed.

willsmithcc
New Contributor III

Same thing happened on a fresh install on a different MacBook. Getting a bunch of operation not permitted. Nothing else has been installed :/

bsuggett
Contributor II

@willsmithcc 

Hmm... Can you confirm the following...

Are you using the Apple App Store or Jamf Pro to deploy and capture the app?

Could you supply each step/steps your using to capture?

Can you confirm your using V3.1 version of the script?

Your different macbook with a fresh install, has it been enrolled into jamf? and or been through DEP enrollment into jamf upon going through the setup assistant?

 

Happy to assist, maybe a zoom call might better.

 

Regards

 

joethedsa
Contributor II

Any updates to this?  I received similar "Operation not permitted" error messages with the script but continued until after I provided a name.  It fails with the following error message:

"hdiutil: create failed - No such file or directory"

I can see the directory "AppStore_Packages" in the Users/Shared folder but it is empty.

I tested mine on Monterey 12.5 and Big Sur 11.6.5. with and without "sudo".  Got the same results.

Dear All,

I think my instructions are a little lacking so will update them.

It should be noted that this script (v3.1) isn't designed to work using the appstore GUI. Its designed to be used with jamf using self service GUI to deploy an app to capture it. The end result is the same...

 

Step 1. Using jamf webUI, target a "Mac App Store" app to your capture machine. (Make avaliable to self service)
Step 2. Using your capture machine, check Self service that you can see your app
Step 3. Run the script using sudo eg "sudo sh ./AppstoreExtract_v3.1.sh"
Step 4. Click on Install in self service
Step 5. Wait until the app is installed and self service is completed the task
Step 6. Navigate to /Users/Shared/AppStore_Packages/ (There should be a PKG in there)
Step 7. Press any key in the script window to stop the script
Step 8. Name the package 
Step 9. The PKG will be deleted and a DMG containing the PKG will be created

You now have a captured AppStore installer one can deploy out.


I've retested this on fresh installs on both macOS 11.6.8 and macOS 12.5.1 and confirmed that the above steps are working.

Important note (Scripting Writers/Users Only):

When jamf tells the machine to fetch/install something from the appstore, its done using sudo which will change the $DARWIN_USER_DIR_PATH. This is the reason why one MUST execute the script using sudo to use the correct $DARWIN_USER_DIR_PATH variable/path

 

 

"hdiutil:...." message disappeared after allowing Terminal to have "full disk access".