Giter Club home page Giter Club logo

macadmin-scripts's Introduction

macadmin-scripts

Some scripts that might be of use to macOS admins. Might be related to Munki; might not.

These are currently only supported using Apple's Python on macOS. There is no support for running these on Windows or Linux.

In macOS 12.3, Apple will be removing its Python 2.7 install. You'll need to provide your own Python to use these scripts. You may also need to install additional Python modules.

getmacosipsws.py

Quick-and-dirty tool to download the macOS IPSW files currently advertised by Apple in the https://mesu.apple.com/assets/macos/com_apple_macOSIPSW/com_apple_macOSIPSW.xml feed.

installinstallmacos.py

This script can create disk images containing macOS Installer applications available via Apple's softwareupdate catalogs.

Run python ./installinstallmacos.py --help to see the available options.

The tool assembles "Install macOS" applications by downloading the packages from Apple's softwareupdate servers and then installing them into a new empty disk image.

If /usr/bin/installer returns errors during this process, it can be useful to examine /var/log/install.log for clues.

Since it is using Apple's installer, any install check or volume check scripts are run. This means that you can only use this tool to create a diskimage containing the versions of macOS that will run on the exact machine you are running the script on.

For example, to create a diskimage containing the version 10.13.6 that runs on 2018 MacBook Pros, you must run this script on a 2018 MacBook Pro, and choose the proper version.

Typically "forked" OS build numbers are 4 digits, so when this document was last updated, build 17G2208 was the correct build for 2018 MacBook Pros; 17G65 was the correct build for all other Macs that support High Sierra.

If you attempt to install an incompatible version of macOS, you'll see an error similar to the following:

Making empty sparseimage...
installer: Error - ERROR_B14B14D9B7
Command '['/usr/sbin/installer', '-pkg', './content/downloads/07/20/091-95774/awldiototubemmsbocipx0ic9lj2kcu0pt/091-95774.English.dist', '-target', '/private/tmp/dmg.Hf0PHy']' returned non-zero exit status 1
Product installation failed.

Use a compatible Mac or select a different build compatible with your current hardware and try again. You may also have success running the script in a VM; the InstallationCheck script in versions of the macOS installer to date skips the checks (and returns success) when run on a VM.

Important note for Catalina+

Catalina privacy protections might interfere with the operation of this tool if you run it from ~/Desktop, ~/Documents, ~/Downloads or other directories protected in Catalina. Consider using /Users/Shared (or subdirectory) as the "working space" for this tool.

Alternate implementations

Graham Pugh has a fork with a lot more features and bells and whistles. Check it out if your needs aren't met by this tool. https://github.com/grahampugh/macadmin-scripts

macadmin-scripts's People

Contributors

aysiu avatar call avatar carlashley avatar chefaustin avatar craig65535 avatar discentem avatar erikng avatar grahampugh avatar gregneagle avatar jthat avatar natewalck avatar shinjukumiku avatar timsutton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

macadmin-scripts's Issues

installinstallmacos.py not creating sparse image

Hi I am running this script in order to get a sparse image but I get an error.

I am using a MacBook Pro Retina 13 inch early 2015 (MacBookPro12,1) running 10.15.7
I am running it like this: python /path/to/installinstallmacos.py --clear --ignore-cache --os=10.15 --raw

The error I get is:
Making empty sparseimage...
installer: Error - the package path specified was invalid: './content/downloads/26/37/001-68446/r1dbqtmf3mtpikjnd04cq31p4jk91dceh8/001-68446.English.dist'.
Command '[u'/usr/sbin/installer', u'-pkg', u'./content/downloads/26/37/001-68446/r1dbqtmf3mtpikjnd04cq31p4jk91dceh8/001-68446.English.dist', u'-target', '/private/tmp/dmg.ZtUJnr']' returned non-zero exit status 1
Product installation failed.

I also have tried using --os=11 but getting the same error.

Am I doing something wrong here ? The mac is hardware ready for Catalina as well as Big Sur.

Feature request: make installinstallmacos.py --list work without root

The --list feature works fine if I comment out the root check, so it would be nice to remove that check when doing --list. Even the import of xattrs could be avoided when using --list so the script doesn't require the particular MacOS python.
Would it be possible to make the script work on linux when just using --list ? (Or does such a tool already exist ?)

updating an iMacPro with High Sierra: "can't install Mojave on a non-apfs-volume.."

mojave installer cannot run cause internal volume is not APFS.. its still high sierra on an internal HFS+-volume..
after we updated many machines to mojave this is probably the last one and now i get this error..
Normally the step of reformatting the drive to APFS was included in mojave-installer I thought..
I tried two different builds, mojave 10.14.4 and 10.14.6.. getting the same result..
Does it make sense to better use an older version of installinstall.py ?
thank u for any help..

distutils removal coming in python 3.12

/Library/Management/erase-install/installinstallmacos.py:45: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.version import LooseVersion

Need a replacement. Take a look at APLooseVersion.

Issue with BoardID on old devices

Issue raised in the erase-install repo: grahampugh/erase-install#39

installinstallmacos.py - get macOS installers from the Apple software catalog

This Mac:
Model Identifier : iMac18,2
Bridge ID        : None
Board ID         : Mac-77F17D7DA9285301
OS Version       : 10.13.4
Build ID         : 17E202

Traceback (most recent call last):
  File "installinstallmacos.py", line 1186, in <module>
    main()
  File "installinstallmacos.py", line 827, in main
    catalog, args.workdir, ignore_cache=args.ignore_cache
  File "installinstallmacos.py", line 590, in os_installer_product_info
    board_ids = get_board_ids(dist_path)
  File "installinstallmacos.py", line 486, in get_board_ids
    if "boardIds" in line:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 121: ordinal not in range(128)

error: Could not find a default catalog url for this OS version.

When I run myMac:macadmin-scripts username$ sudo /Users/username/git/macadmin-scripts/installinstallmacos.py I am getting the error Could not find a default catalog url for this OS version. Can anybody tell me how to define a catalog url for my OS version (I would like to install macOS 10.13 (High Sierra)), since it’s the last macOS compatible to my iMac 27inch (mid 2011)? Thank you in advance for your help.

Below is the complete output of my Terminal after the execution of the installintallmacos.py

myMac:macadmin-scripts username$ sudo /Users/username/git/macadmin-scripts/installinstallmacos.py

installinstallmacos.py - get macOS installers from the Apple software catalog

This Mac:
Model Identifier : iMac12,2

Board ID         : Mac-942B59F58194171B
OS Version       : 10.11.6
Build ID         : 15G22010

Could not find a default catalog url for this OS version.

SyntaxError: invalid character '·' (U+00B7)

trying to output --raw of Mojave 10.14.6 but getting back

File "/Users/Shared/installinstallmacos.py", line 72 <title>macadmin-scripts/installinstallmacos.py at main · grahampugh/macadmin-scripts · GitHub</title> ^ SyntaxError: invalid character '·' (U+00B7)

Installation failed

Hello,
i downloaded latest big sur installer from your script but i get this error:

Command '[u'/usr/sbin/installer', u'-pkg', u'./content/downloads/12/32/071-14766-A_Q2H6ELXGVG/zx8saim8tei7fezrmvu4vuab80m0e8a5ll/071-14766.English.dist', u'-target', '/private/tmp/dmg.935Cdu']' returned non-zero exit status 1
Product installation failed.
Command '[u'/usr/sbin/installer', u'-pkg', u'./content/downloads/12/32/071-14766-A_Q2H6ELXGVG/zx8saim8tei7fezrmvu4vuab80m0e8a5ll/071-14766.English.dist', u'-target', '/private/tmp/dmg.935Cdu']' returned non-zero exit status 1
Product installation failed.

Is there any workaround?

[FR] PyPI: package this as a pip-installable app?

Hi, currently I'm forced to just wget the installinstallmacos.py from GitHub when I want to use it in an automation. Having a lot experience with Python packaging ecosystem, I think that it'd be rather great having this published to PyPI.
So it'd be possible to do something like pip install macadmin-scripts and run the corresponding script via installinstallmacos or maybe python -m installinstallmacos. This would also allow declaring the dependencies so that the hack with ImportError for informing the end-users that they need to learn how to install something extra wouldn't be necessary.
Maintaining a package metadata declaration isn't too much burden, in my experience. And publishing to PyPI is possible through GHA so the release would be a single-click process. I'm willing to help with setting up this stuff, if needed.

NO New Updates Anymore!

Hi, I have run for a while the script with no issue, both on Mojave and Big Sur. Downloaded and installed a few OS perfectly. Thank you.

However, lately seem to be stack showing always the some built and no new release. I have update Big Sur to 11.2 b2 showed via System Preferences but not from the script which is stack to 11.1.

I did tried to run the script with the --ignore-cache flag but didnt solved the issue.

Any help would be greatly appreciated.
Thank you in advance.
gC

The install failed.

Hello,

I have problem to run installinstallmacos.py . I see that this mac is not correctly identified. I have MacBook Pro (15-inch, 2016). I report below is MacBookPro13 which is i think different model. At the end whole installation fails. From log I can't say why.

Here is my console log:

Jans-MBP-2:macadmin-scripts jan$ sudo ./installinstallmacos.py --workdir ~/Downloads/macosx/ --version 11.2.3
Password:

installinstallmacos.py - get macOS installers from the Apple software catalog

This Mac:
Model Identifier : MacBookPro13,3

Bridge ID        : X619AP
Board ID         : Mac-A5C67F76ED83108C
OS Version       : 10.15.7
Build ID         : 19H524

 #  ProductID       Version    Build    Post Date   Title                          
 1  001-15219       10.15.5    19F2200  2020-06-15  macOS Catalina                 
 2  001-68446       10.15.7    19H15    2020-11-11  macOS Catalina                 
 3  001-04366       10.15.4    19E2269  2020-05-04  macOS Catalina                 
 4  071-08935       11.2.2     20D80    2021-03-01  macOS Big Sur                  
 5  061-86291       10.15.3    19D2064  2020-03-23  macOS Catalina                 
 6  041-91758       10.13.6    17G66    2019-10-19  macOS High Sierra              
 7  041-88800       10.14.4    18E2034  2019-10-23  macOS Mojave                   
 8  071-14766       11.2.3     20D91    2021-03-08  macOS Big Sur                  
 9  061-26589       10.14.6    18G103   2019-10-14  macOS Mojave                   
10  071-05432       11.2.1     20D75    2021-02-15  macOS Big Sur                  
11  001-51042       10.15.7    19H2     2020-09-24  macOS Catalina                 
12  001-36735       10.15.6    19G2006  2020-08-06  macOS Catalina                 
13  001-57224       10.15.7    19H4     2020-10-27  macOS Catalina                 
14  041-90855       10.13.5    17F66a   2019-10-23  Install macOS High Sierra Beta 
15  061-26578       10.14.5    18F2059  2019-10-14  macOS Mojave                   
16  001-36801       10.15.6    19G2021  2020-08-12  macOS Catalina                 

Build 20D91 selected. Downloading #8...

** Resuming transfer from byte position 5841
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0  5841    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
** Resuming transfer from byte position 5242218140
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 6646M  100 6646M    0     0  1247k      0  1:30:56  1:30:56 --:--:-- 1400k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 35607  100 35607    0     0   164k      0 --:--:-- --:--:-- --:--:--  164k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 2571k  100 2571k    0     0  1313k      0  0:00:01  0:00:01 --:--:-- 1312k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1935k  100 1935k    0     0  1299k      0  0:00:01  0:00:01 --:--:-- 1299k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   188  100   188    0     0   2540      0 --:--:-- --:--:-- --:--:--  2540
Making empty sparseimage...
installer: Package name is macOS Big Sur
installer: Installing at base path /private/tmp/dmg.m2h8xa
installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. An error occurred while running scripts from the package “InstallAssistant.pkg”.)
Command '[u'/usr/sbin/installer', u'-pkg', u'/Users/jan/Downloads/macosx/content/downloads/12/32/071-14766-A_Q2H6ELXGVG/zx8saim8tei7fezrmvu4vuab80m0e8a5ll/071-14766.English.dist', u'-target', '/private/tmp/dmg.m2h8xa']' returned non-zero exit status 1
Product installation failed.

Thanks for help.

ditto fails during "install_product" when building Catalina 10.15.4 with "No space left on device"

Sadly, ditto fails during "install_product" when building Catalina 10.15.4 with "No space left on device".

`Making empty sparseimage...
installer: Package name is macOS Catalina
installer: Installing at base path /private/tmp/dmg.0eWnff
installer: The install was successful.


*** Working around a very dumb Apple bug in a package ***
*** postinstall script that fails to correctly target ***
*** the Install macOS.app when installed to a volume ***
*** other than the current boot volume. ***
*** Please file feedback with Apple! ***


ditto: /private/tmp/dmg.0eWnff/Applications/Install macOS Catalina.app/Contents/SharedSupport/BaseSystem.dmg: No space left on device
Traceback (most recent call last):
File "/Users/luser/bin/installinstallmacos.py", line 891, in
main()
File "/Users/luser/bin/installinstallmacos.py", line 858, in main
mountpoint)
File "/Users/luser/bin/installinstallmacos.py", line 292, in install_product
os.path.join(target_vol, 'Applications')]
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 190, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '[u'/usr/bin/ditto', u'/private/tmp/dmg.0eWnffApplications', u'/private/tmp/dmg.0eWnff/Applications']' returned non-zero exit status 1
`

Bails leaving dmg mounted and folder/file(s) in tmp…

TypeError: argument of type 'NoneType' is not iterable

PublicSeed seems to work OK but CustomerSeed and DeveloperSeed are giving me errors.

ISTR that this was working just a day or two ago (maybe yesterday) so I am wondering if perhaps Apple changed something.


CustomerSeed

sudo installinstallmacos.py  --seedprogram CustomerSeed

installinstallmacos.py - get macOS installers from the Apple software catalog

This Mac:
Model Identifier : MacBookPro16,1
Board ID         : Mac-E1008331FDC96864
OS Version       : 10.15.6
Build ID         : 19G73

No server metadata for 001-26097
 #  ProductID       Version    Build    Post Date   Title                          Notes
 1  061-77704       10.15.4    19E242d  2020-02-26  macOS Catalina Beta            Unsupported macOS version
 2  001-15219       10.15.5    19F2200  2020-06-15  macOS Catalina                 Unsupported Board ID
 3  001-06847       10.15.6    19G60d   2020-06-30  macOS Catalina Beta
 4  001-04366       10.15.4    19E2269  2020-05-04  macOS Catalina                 Unsupported Board ID
 5  061-86291       10.15.3    19D2064  2020-03-23  macOS Catalina                 Unsupported Board ID
 6  041-91758       10.13.6    17G66    2019-10-19  macOS High Sierra              Unsupported Board ID
 7  041-88800       10.14.4    18E2034  2019-10-23  macOS Mojave                   Unsupported Board ID
 8  061-26589       10.14.6    18G103   2019-10-14  macOS Mojave                   Unsupported Board ID
 9  061-94403       10.15.6    19G73    2020-07-15  macOS Catalina
Traceback (most recent call last):
  File "/usr/local/scripts/installinstallmacos.py", line 1125, in <module>
    main()
  File "/usr/local/scripts/installinstallmacos.py", line 809, in main
    if hw_model in product_info[product_id]["UnsupportedModels"] and is_vm == False:
TypeError: argument of type 'NoneType' is not iterable

DeveloperSeed


sudo installinstallmacos.py  --seedprogram DeveloperSeed

installinstallmacos.py - get macOS installers from the Apple software catalog

This Mac:
Model Identifier : MacBookPro16,1
Board ID         : Mac-E1008331FDC96864
OS Version       : 10.15.6
Build ID         : 19G73

No server metadata for 001-26097
 #  ProductID       Version    Build    Post Date   Title                          Notes
 1  061-77704       10.15.4    19E242d  2020-02-26  macOS Catalina Beta            Unsupported macOS version
 2  001-15219       10.15.5    19F2200  2020-06-15  macOS Catalina                 Unsupported Board ID
 3  001-04366       10.15.4    19E2269  2020-05-04  macOS Catalina                 Unsupported Board ID
 4  061-86291       10.15.3    19D2064  2020-03-23  macOS Catalina                 Unsupported Board ID
 5  041-91758       10.13.6    17G66    2019-10-19  macOS High Sierra              Unsupported Board ID
 6  041-88800       10.14.4    18E2034  2019-10-23  macOS Mojave                   Unsupported Board ID
 7  061-26589       10.14.6    18G103   2019-10-14  macOS Mojave                   Unsupported Board ID
 8  061-94403       10.15.6    19G73    2020-07-15  macOS Catalina
Traceback (most recent call last):
  File "/usr/local/scripts/installinstallmacos.py", line 1125, in <module>
    main()
  File "/usr/local/scripts/installinstallmacos.py", line 809, in main
    if hw_model in product_info[product_id]["UnsupportedModels"] and is_vm == False:
TypeError: argument of type 'NoneType' is not iterable

"content resides on a read-only file system."

Tried moving the script to /Users/Shared (as suggested here: ) and changed perms to 777 but still get this error:

./content resides on a read-only file system.
Could not replicate https://swscan.apple.com/content/catalogs/others/index-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog: Command '[u'/usr/bin/curl', u'-sfL', u'--create-dirs', u'-o', u'./content/catalogs/others/index-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog', u'https://swscan.apple.com/content/catalogs/others/index-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog']' returned non-zero exit status 23

OS Version : 10.15.6
Build ID : 19G2021

After loading to USB device via Disk Utilities, MacBook Air does not detect USB device while in target boot mode

Steps to produce

  • Successfully ran installinstallmacos.py, created Catalina installer (latest version) on MacBook Air.
    • No errors on termination of the script.
  • Used Disk Utilities and Restore to load produced .dmg file to USB device (16GB thumb drive).
  • When booting by holding down option, the thumb drive is not recognized.

Notes/Troubleshooting

  • Flags include boot and all files appear to be present. Is this user error?
  • The same MacBook Air was used to produced the files/drive that is trying to utilize the install, so that requirement should be satisfied.
  • This MacBook Air shows an install of High Sierra on a thumb drive produced by the official instructions.
  • This thumb drive (with Catalina currently loaded) had previously been used to install High Sierra, so the thumb drive shouldn't be the problem.

Are there any steps I can take to further test or produce debugging output to confirm the script ran successfully?

installinstallmacos fails on 11.2.3

$ ./installinstallmacos.py

 8      071-14766     11.2.3    20D91  2021-03-08  macOS Big Sur

<selected >

Downloading files

<SNIP>

Making empty sparseimage...
installer: Package name is macOS Big Sur
installer: Installing at base path /private/tmp/dmg.sUSsE3
installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. An error occurred while running scripts from the package “InstallAssistant.pkg”.)
Command '[u'/usr/sbin/installer', u'-pkg', u'./content/downloads/12/32/071-14766-A_Q2H6ELXGVG/zx8saim8tei7fezrmvu4vuab80m0e8a5ll/071-14766.English.dist', u'-target', '/private/tmp/dmg.sUSsE3']' returned non-zero exit status 1
Product installation failed.

OS not downloading

issue persists the same after the new version is not moving forward.

Script result:
[erase-install] v0.6.1 script execution started: Fri Dec 11 17:40:15 IST 2020
[erase-install] Caffeinating this script (pid=49514)
[erase-install] Looking for existing installer
[find_existing_installer] No valid installer found.
[erase-install] Starting download process
[erase-install] Opening jamfHelper download message (language=en)
[get_installinstallmacos] installinstallmacos.py is in /Library/Management/erase-install
[run_installinstallmacos] Checking that selected build 19H15 is available

[run_installinstallmacos] This command is now being run:

installinstallmacos.py --workdir=/Library/Management/erase-install --ignore-cache --raw --build=19H15 --validate
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 1976 100 1976 0 0 21617 0 --:--:-- --:--:-- --:--:-- 21714
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 475M 0 395k 0 0 603k 0 0:13:27 --:--:-- 0:13:27 603k
0 475M 0 1320k 0 0 796k 0 0:10:11 0:00:01 0:10:10 796k
0 475M 0 2489k 0 0 937k 0 0:08:39 0:00:02 0:08:37 937k
0 475M 0 3989k 0 0 1083k 0 0:07:29 0:00:03 0:07:26 1083k
1 475M 1 5557k 0 0 1193k 0 0:06:47 0:00:04 0:06:43 1193k
1 475M 1 7046k 0 0 1245k 0 0:06:30 0:00:05 0:06:25 1330k

39 7379M 39 2951M 0 0 930k 0 2:15:19 0:54:07 1:21:12 0
39 7379M 39 2951M 0 0 930k 0 2:15:22 0:54:08 1:21:14 0
39 7379M 39 2951M 0 0 930k 0 2:15:24 0:54:09 1:21:15 0
39 7379M 39 2951M 0 0 929k 0 2:15:26 0:54:09 1:21:17 0
curl: (56) Recv failure: Connection reset by peer
Could not replicate http://swcdn.apple.com/content/downloads/26/37/001-68446/r1dbqtmf3mtpikjnd04cq31p4jk91dceh8/InstallESDDmg.pkg: Command '[u'/usr/bin/curl', u'-fL', u'--create-dirs', u'-o', u'/Library/Management/erase-install/content/downloads/26/37/001-68446/r1dbqtmf3mtpikjnd04cq31p4jk91dceh8/InstallESDDmg.pkg', u'--compressed', 'http://swcdn.apple.com/content/downloads/26/37/001-68446/r1dbqtmf3mtpikjnd04cq31p4jk91dceh8/InstallESDDmg.pkg']' returned non-zero exit status 56

installinstallmacos.py - get macOS installers from the Apple software catalog

This Mac:
Model Identifier : MacBookPro14,1

Bridge ID : None
Board ID : Mac-B4831CEBD52A0C4C
OS Version : 10.13.6
Build ID : 17G11023
ProductID Version Build Post Date Title

1 001-68446 10.15.7 19H15 2020-11-11 macOS Catalina

Build 19H15 available. Downloading #1...

[run_installinstallmacos] Error obtaining valid installer. Cannot continue.
[erase-install] 'jamfHelper' ended

Installation error

Making empty sparseimage...
installer: Package name is macOS Big Sur
installer: Installing at base path /private/tmp/dmg.6OA2vz
installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. An error occurred while running scripts from the package “InstallAssistant.pkg”.)
Command '[u'/usr/sbin/installer', u'-pkg', u'./content/downloads/55/59/071-00696-A_4T69TQR1VO/9psvjmwyjlucyg708cqjeaiylrvb0xph94/071-00696.English.dist', u'-target', '/private/tmp/dmg.6OA2vz']' returned non-zero exit status 1
Product installation failed.

installinstallmacos.py

The shebang at the top calls for /usr/bin/python, which on MacOS defaults to Python 2.7. This means that your script will always default to using Python 2.7.

Wrong macOS version gets downloaded

Hi

I tested the script installinstallmacos.py on my machine and i selected the option to download macOS 10.15.7-19H15. The script however downloads version macOS-10.15.7-19H11 instead!

This is the scripts output on my machine:

This Mac:
Model Identifier : Macmini7,1

Bridge ID        : None
Board ID         : Mac-35C5E08120C7EEAF
OS Version       : 10.15.7
Build ID         : 19H15

 #  ProductID       Version    Build    Post Date   Title                          
 1  001-15219       10.15.5    19F2200  2020-06-15  macOS Catalina                 
 2  001-68446       10.15.7    19H15    2020-11-11  macOS Catalina                 
 3  001-04366       10.15.4    19E2269  2020-05-04  macOS Catalina                 
 4  061-86291       10.15.3    19D2064  2020-03-23  macOS Catalina                 
 5  041-91758       10.13.6    17G66    2019-10-19  macOS High Sierra              
 6  001-57224       10.15.7    19H4     2020-10-27  macOS Catalina                 
 7  061-26589       10.14.6    18G103   2019-10-14  macOS Mojave                   
 8  001-51042       10.15.7    19H2     2020-09-24  macOS Catalina                 
 9  001-36735       10.15.6    19G2006  2020-08-06  macOS Catalina                 
10  001-83532       11.0.1     20B50    2020-11-19  macOS Big Sur                  
11  041-88800       10.14.4    18E2034  2019-10-23  macOS Mojave                   
12  041-90855       10.13.5    17F66a   2019-10-23  Install macOS High Sierra Beta 
13  061-26578       10.14.5    18F2059  2019-10-14  macOS Mojave                   
14  001-36801       10.15.6    19G2021  2020-08-12  macOS Catalina         

I select option 2 and it downloads everything and creates a .dmg file. But the version of the installer inside the dmg file is wrong.

This is the content of the file Info.plist inside the downloaded installer app:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Application-Group</key>
	<string>AirPort</string>
	<key>BuildMachineOSBuild</key>
	<string>18A391024</string>
	<key>CFBundleDevelopmentRegion</key>
	<string>English</string>
	<key>CFBundleDisplayName</key>
	<string>Install macOS Catalina</string>
	<key>CFBundleExecutable</key>
	<string>InstallAssistant_springboard</string>
	<key>CFBundleGetInfoString</key>
	<string>Install macOS Catalina, Copyright © 2007-2020 Apple Inc. All rights reserved.</string>
	<key>CFBundleIconFile</key>
	<string>InstallAssistant</string>
	<key>CFBundleIdentifier</key>
	<string>com.apple.InstallAssistant.Catalina</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>Install mac OS</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>15.7.03</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleSupportedPlatforms</key>
	<array>
		<string>MacOSX</string>
	</array>
	<key>CFBundleURLTypes</key>
	<array>
		<dict>
			<key>CFBundleURLName</key>
			<string>Open Install OS X URL</string>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>x-install-osx-assistant</string>
			</array>
		</dict>
	</array>
	<key>CFBundleVersion</key>
	<string>15703</string>
	<key>DTCompiler</key>
	<string>com.apple.compilers.llvm.clang.1_0</string>
	<key>DTPlatformBuild</key>
	<string>11O62d</string>
	<key>DTPlatformName</key>
	<string>macosx</string>
	<key>DTPlatformVersion</key>
	<string>10.15.6</string>
	<key>DTSDKBuild</key>
	<string>19H11</string>
	<key>DTSDKName</key>
	<string>macosx10.15internal</string>
	<key>DTXcode</key>
	<string>1140</string>
	<key>DTXcodeBuild</key>
	<string>11O62d</string>
	<key>LSApplicationCategoryType</key>
	<string>public.app-category.utilities</string>
	<key>LSArchitecturePriority</key>
	<array>
		<string>x86_64</string>
		<string>i386</string>
		<string>ppc</string>
	</array>
	<key>LSHasLocalizedDisplayName</key>
	<true/>
	<key>LSMinimumSystemVersion</key>
	<string>10.9</string>
	<key>MinimumOSVersion</key>
	<string>10.9</string>
	<key>NSMainNibFile</key>
	<string>MainMenu</string>
	<key>NSPrincipalClass</key>
	<string>NSApplication</string>
	<key>NSSupportsAutomaticGraphicsSwitching</key>
	<true/>
	<key>ProductPageIconFile</key>
	<string>ProductPageIcon.icns</string>
</dict>
</plist>

The command softwareupdate --fetch-full-installer --full-installer-version 10.15.7 also downloads the wrong version.

Do you have any idea why that is? Could it be, that the wrong build is installed on my machine?

Thanks! Manuel

Facility to Restart Interrupted Download?

Thank you for maintaining this project.
I wondered if there is any capability built into or planned for macadmin-scripts to allow the restart (from where it got to) of a download in the event of a curl: (56) Recv failure: Connection reset by peer?
While attempting to download the following item:
14 042-45246 11.7.10 20G1427 2023-09-11 macOS Big Sur
... the following error resulted over halfway through the download:
Choose a product to download (1-26): 14
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5782 100 5782 0 0 27353 0 --:--:-- --:--:-- --:--:-- 28343
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
56 11.5G 56 6635M 0 0 502k 0 6:41:59 3:45:15 2:56:44 0
curl: (56) Recv failure: Connection reset by peer
Could not replicate http://swcdn.apple.com/content/downloads/14/38/042-45246-A_NLFOFLCJFZ/jk992zbv98sdzz3rgc7mrccjl3l22ruk1c/InstallAssistant.pkg: Command '[u'/usr/bin/curl', u'-fL', u'--create-dirs', u'-o', u'./content/downloads/14/38/042-45246-A_NLFOFLCJFZ/jk992zbv98sdzz3rgc7mrccjl3l22ruk1c/InstallAssistant.pkg', u'-w', u'%{http_code}', u'--compressed', 'http://swcdn.apple.com/content/downloads/14/38/042-45246-A_NLFOFLCJFZ/jk992zbv98sdzz3rgc7mrccjl3l22ruk1c/InstallAssistant.pkg']' returned non-zero exit status 56

Or is only solution to attempt the download again from scratch?

error message and script fail - remotectl on non T2 mac

Running script through the erase-install tool. Has worked fine until today. Errors on a non T2 macbook and imac. Error message below:

Traceback (most recent call last):
  File "/Library/Management/erase-install/installinstallmacos.py", line 1184, in <module>
    main()
  File "/Library/Management/erase-install/installinstallmacos.py", line 778, in main
    bridge_id = get_bridge_id()
  File "/Library/Management/erase-install/installinstallmacos.py", line 115, in get_bridge_id
    raise ReplicationError(err)
__main__.ReplicationError: Command '[u'/usr/libexec/remotectl', u'get-property', u'localbridge', u'HWModel']' returned non-zero exit status 65

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.