Skip to content

Instantly share code, notes, and snippets.

@geoff-nixon
Created December 7, 2015 10:51
Show Gist options
  • Star 35 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save geoff-nixon/b96bc9c5bca538aa0819 to your computer and use it in GitHub Desktop.
Save geoff-nixon/b96bc9c5bca538aa0819 to your computer and use it in GitHub Desktop.
#!/bin/sh -x ## or just ` curl -Ls http://git.io/vRozn | sh `.
## Downloads the Mac OS X 10.10 Recovery Partition update,
## Copy's over the 10.10 version of Disk Utility.app, then
## use git to apply a binary patch so it will run on 10.11+.
cd /tmp
rm -rf DU1010
mkdir DU1010
cd DU1010
# See: https://github.com/wdas/reposado
curl -ORL http://swcdn.apple.com/content/downloads/21/09/031-20634/8d84o1ky5gn2agnf5kiz9eed134n7y3q4c/RecoveryHDUpdate.pkg
xar -xf RecoveryHDUpdate.pkg
hdiutil attach -nobrowse RecoveryHDMeta.dmg
hdiutil attach -nobrowse "/Volumes/Recovery HD Update/BaseSystem.dmg"
cp -Rp "/Volumes/OS X Base System/Applications/Utilities/Disk Utility.app" .
hdiutil detach "/Volumes/OS X Base System"
hdiutil detach "/Volumes/Recovery HD Update"
rm * 2>/dev/null
git apply --no-index <<-PATCH
diff --git a/Disk Utility.app/Contents/MacOS/Disk Utility b/Disk Utility.app/Contents/MacOS/Disk Utility
index 20f16f995699699ac5841a455c261a2e45e6a4e5..ce4994ac078a99803ba6b5f3467fae425b5bf643 100755
GIT binary patch
delta 44
scmZoTC);pNcEgiI#+K%%iS17l8G)Dyh?#+y1&CRJm~H#hM0ROb0OUIqApigX
delta 44
scmZoTC);pNcEgiI#@6PiiS17l8G)Dyh?#+y1&CRJm~H#hM0ROb0OVa1A^-pY
PATCH
mv "Disk Utility.app" "Disk Utility (10.10).app"
open .
@hatoncat
Copy link

Couple notes:

  1. You have to install Xcode before running
  2. You have to run sudo git at least once first to accept the license agreement (because for some reason Apple wants you to accept a license agreement when running their build of git - seriously?)

@superbonaci
Copy link

Thank you very much!

@wamatt
Copy link

wamatt commented Dec 31, 2015

Works like a charm - Ty!

@pftbest
Copy link

pftbest commented Jan 2, 2016

Thanks!

@dlamblin
Copy link

Patching failed for me. I'll check if I copied something incorrectly (are there any hidden characters in the raw?)

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  480M  100  480M    0     0  6933k      0  0:01:10  0:01:10 --:--:-- 6993k
………
Checksumming  (Apple_Free : 4)…
                    (Apple_Free : 4): verified   CRC32 $00000000
verified   CRC32 $BEEF351A
/dev/disk4              Apple_partition_scheme          
/dev/disk4s1            Apple_partition_map             
/dev/disk4s2            Apple_HFS                       /Volumes/OS X Base System
"disk4" unmounted.
"disk4" ejected.
"disk3" unmounted.
"disk3" ejected.
error: corrupt binary patch at line 6: delta 44
fatal: patch with only garbage at line 7

Saving the raw file and running that worked. Previously I had selected all the text, copied it, and used pbpaste > du_patch.sh which I ran. Oddly a diff shows no differences between the two.

@dananau
Copy link

dananau commented Feb 16, 2016

Thanks! Haven't done much testing, but it seems to work fine.

Copy link

ghost commented Feb 18, 2016

Patching failed for me too so i got out my trusted disassembler and just patched
0x00000001000061e3 0F8544010000 jne 0x10000632d
to
0x00000001000061e3 0F8444010000 je 0x10000632d
which works for the 64 bit ver only for running in 10.11 and upwards

Copy link

ghost commented Feb 19, 2016

Hey Geoff,

Awesome script. I forked and adapted it if you wanted to have a look! I addressed a few potential things such as checking for xcode and it's license agreement. I also added a little function to package it up for easy installation.

To everyone with patching issues, diff can be really picky, especially when used in scripts. Make sure that everything between <<-PATCH and PATCH is properly formatted, i.e. no leading spaces or tabs and no carriage returns.

@i8degrees
Copy link

You are truly a life saver! Thanks a ton

@xtian08
Copy link

xtian08 commented Jun 21, 2016

Great Script, thanks Geoff

@a0s
Copy link

a0s commented Jun 25, 2016

@gopiganti
Copy link

Hello,

Thanks for such nice solution to use Disk Utility of 10.10 in 10.11.
Just now installed macOS Sierra Public Beta and tried your the solution and am getting the following error.
"
Termination Reason: DYLD, [0x4] Symbol missing
Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
Symbol not found: _kDMMediaTypeCDROM
Referenced from: /Applications/Utilities/Disk Utility Yosemite.app/Contents/MacOS/../Frameworks/DUSupport.framework/Versions/A/DUSupport
Expected in: /System/Library/PrivateFrameworks/DiskManagement.framework/Versions/A/DiskManagement
in /Applications/Utilities/Disk Utility Yosemite.app/Contents/MacOS/../Frameworks/DUSupport.framework/Versions/A/DUSupport
"
Please try and find a working solution.

@superbonaci
Copy link

Working perfectly, thank you very much!

@avujnic
Copy link

avujnic commented Feb 1, 2017

Is this possible in Sierra?

@mcohrs
Copy link

mcohrs commented Aug 22, 2017

Ca you please add support for sierra? macOS 12.4 =>

@mcohrs
Copy link

mcohrs commented Aug 22, 2017

Thank you :)

@kbansal
Copy link

kbansal commented Jun 2, 2018

I was able to get it to work on Sierra.

The issue was some missing symbols (_kDMMediaTypeCDROM and _DIHLGetBundleSize), which are only found in old frameworks. So just copy them over and use install_name_tool to load them instead.

  1. Run the script as above.

  2. Re-download the package and mount them:

curl -ORL http://swcdn.apple.com/content/downloads/21/09/031-20634/8d84o1ky5gn2agnf5kiz9eed134n7y3q4c/RecoveryHDUpdate.pkg

xar -xf RecoveryHDUpdate.pkg

hdiutil attach -nobrowse RecoveryHDMeta.dmg
hdiutil attach -nobrowse "/Volumes/Recovery HD Update/BaseSystem.dmg"
  1. Copy over DiskManagement.framework and DiskImages.framework from

/Volumes/OS X Base System/System/Library/PrivateFrameworks

to

/tmp/DU1010/Disk Utility (10.10).app/Contents/Frameworks

  1. Use install_name_tool to change where to look for those shared libraries (use otool -L in before/after to confirm that paths are really changing).
cd "/tmp/DU1010/Disk Utility (10.10).app/Contents/MacOS"
install_name_tool -change /System/Library/PrivateFrameworks/DiskManagement.framework/Versions/A/DiskManagement @executable_path/../Frameworks/DiskManagement.framework/Versions/A/DiskManagement Disk\ Utility
install_name_tool -change /System/Library/PrivateFrameworks/DiskImages.framework/Versions/A/DiskImages @executable_path/../Frameworks/DiskImages.framework/Versions/A/DiskImages Disk\ Utility

@DoctorDan1986
Copy link

Doesn't work. Under 10.13.6, it won't even start.

@Denial-Steinberg
Copy link

on 10.14.6
Dyld Error Message:
Symbol not found: OBJC_CLASS$_NSStatusBarWindow
Referenced from: /Volumes/VOLUME/Yosemite Disk Utility For El Capitan.app/Contents/MacOS/Disk Utility
Expected in: /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
in /Volumes/VOLUME/Yosemite Disk Utility For El Capitan.app/Contents/MacOS/Disk Utility

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