Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@import Darwin;
@import ObjectiveC;
@import CloudKit;
extern bool GEOConfigGetBOOL(int feature, void* something);
// Hooks feature flags in a resigned Maps.app to return true.
// Usage:
// clang -shared -fmodules -o libmaps_inject.dylib maps_inject.m \
// "$(xcrun
// --show-sdk-path)/System/Library/PrivateFrameworks/GeoServices.framework/GeoServices.tbd"
// cp -a /System/Applications/Maps.app ./
// codesign --remove Maps.app/Contents/MacOS/Maps
// DYLD_INSERT_LIBRARIES=./libmaps_inject.dylib Maps.app/Contents/MacOS/Maps
#define DYLD_INTERPOSE(_replacement, _replacee) \
__attribute__((used)) static struct { \
const void* replacement; \
const void* replacee; \
} _interpose_##_replacee __attribute__((section("__DATA,__interpose"))) = { \
(const void*)(unsigned long)&_replacement, (const void*)(unsigned long)&_replacee}
bool wdb_GEOConfigGetBOOL(int feature, void* something) {
if (feature == 5) {
NSLog(@"config get VectorKitDebugConfig_AllowNonSupportedDeviceAdvancedMap");
return true;
}
NSLog(@"config get bool %d", feature);
return GEOConfigGetBOOL(feature, something);
}
DYLD_INTERPOSE(wdb_GEOConfigGetBOOL, GEOConfigGetBOOL);
// Our resigned Maps app doesn't have iCloud access, so disable iCloud.
// (Not necessary if you're running with SIP off and injecting into the real
// Maps app)
id wdb_CKContainer_initWithContainerID_hook() { return nil; }
id wdb_CKContainer_initWithContainerID_options_hook() { return nil; }
__attribute__((constructor)) void wdb_hook_init() {
Class ckContainerClass = [CKContainer class];
Method method1 = class_getInstanceMethod(ckContainerClass, @selector(initWithContainerID:));
method_setImplementation(method1, (IMP)&wdb_CKContainer_initWithContainerID_hook);
Method method2 = class_getInstanceMethod(ckContainerClass, @selector(initWithContainerID:
options:));
method_setImplementation(method2, (IMP)&wdb_CKContainer_initWithContainerID_options_hook);
}
@Hanly-Wijaya

This comment has been minimized.

Copy link

@Hanly-Wijaya Hanly-Wijaya commented Jun 10, 2021

How do you use it?

@PencilNotPen

This comment has been minimized.

Copy link

@PencilNotPen PencilNotPen commented Jun 10, 2021

As the user above requested, would it be possible to get a brief explanation of how to implement this solution, for those of us not proficient with coding?

Many thanks for your help!

@LukasAppleFan

This comment has been minimized.

Copy link

@LukasAppleFan LukasAppleFan commented Jun 10, 2021

Like the two users above I would like to know how to implement this

@jkaunert

This comment has been minimized.

Copy link

@jkaunert jkaunert commented Jun 10, 2021

The usage is right there in the commented out code…

@notnotjake

This comment has been minimized.

Copy link

@notnotjake notnotjake commented Jun 10, 2021

Download the file and put file on Desktop.
Open Terminal and navigate to Desktop cd Desktop

You must have Xcode Command Line Tools installed. Use xcode-select --install to install them if you don't already have them installed.

Next, run the following commands one at a time (paste and hit Enter):

  1. clang -shared -fmodules -o libmaps_inject.dylib maps_inject.m \
  2. "$(xcrun --show-sdk-path)/System/Library/PrivateFrameworks/GeoServices.framework/GeoServices.tbd"
  3. cp -a /System/Applications/Maps.app ./
  4. codesign --remove Maps.app/Contents/MacOS/Maps
  5. DYLD_INSERT_LIBRARIES=./libmaps_inject.dylib Maps.app/Contents/MacOS/Maps
    At this point Terminal should start doing stuff and Maps should open up.

Hope this helps

@LukasAppleFan

This comment has been minimized.

Copy link

@LukasAppleFan LukasAppleFan commented Jun 10, 2021

Ok thank you

@Hanly-Wijaya

This comment has been minimized.

Copy link

@Hanly-Wijaya Hanly-Wijaya commented Jun 11, 2021

Download the file and put file on Desktop.
Open Terminal and navigate to Desktop cd Desktop

You must have Xcode Command Line Tools installed. Use xcode-select --install to install them if you don't already have them installed.

Next, run the following commands one at a time (paste and hit Enter):

  1. clang -shared -fmodules -o libmaps_inject.dylib maps_inject.m \
  2. "$(xcrun --show-sdk-path)/System/Library/PrivateFrameworks/GeoServices.framework/GeoServices.tbd"
  3. cp -a /System/Applications/Maps.app ./
  4. codesign --remove Maps.app/Contents/MacOS/Maps
  5. DYLD_INSERT_LIBRARIES=./libmaps_inject.dylib Maps.app/Contents/MacOS/Maps
    At this point Terminal should start doing stuff and Maps should open up.

Hope this helps

Hey, I keep getting this error. Do you know what to do? Thanks.

hanlywijaya@Hanlys-iMac Desktop % clang -shared -fmodules -o libmaps_inject.dylib maps_inject.m \

Undefined symbols for architecture x86_64:
"_GEOConfigGetBOOL", referenced from:
_wdb_GEOConfigGetBOOL in maps_inject-545e35.o
__interpose_GEOConfigGetBOOL in maps_inject-545e35.o
(maybe you meant: _wdb_GEOConfigGetBOOL)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@PencilNotPen

This comment has been minimized.

Copy link

@PencilNotPen PencilNotPen commented Jun 11, 2021

Download the file and put file on Desktop.
Open Terminal and navigate to Desktop cd Desktop

You must have Xcode Command Line Tools installed. Use xcode-select --install to install them if you don't already have them installed.

Next, run the following commands one at a time (paste and hit Enter):

  1. clang -shared -fmodules -o libmaps_inject.dylib maps_inject.m \
  2. "$(xcrun --show-sdk-path)/System/Library/PrivateFrameworks/GeoServices.framework/GeoServices.tbd"
  3. cp -a /System/Applications/Maps.app ./
  4. codesign --remove Maps.app/Contents/MacOS/Maps
  5. DYLD_INSERT_LIBRARIES=./libmaps_inject.dylib Maps.app/Contents/MacOS/Maps
    At this point Terminal should start doing stuff and Maps should open up.

Hope this helps

Thanks! This helped a lot. It works for me.

These instructions create a new Maps.app on the Desktop which is patched. The author of the gist mentioned that it was possible to instead patch the stock Maps.app in /Applications, instead of making a second one on the Desktop. Given that I have SIP disabled, how would I go about patching the stock Maps.app instead?

Also, the patched Maps.app on the Desktop, which this process creates, quits on open when double clicked to open. To launch it, I must re-run the final Terminal command. Is there a way to have the final Maps.app launch without crashing with just a double-click, without using Terminal to launch each time?

Thanks very much for your help!

@Hanly-Wijaya

This comment has been minimized.

Copy link

@Hanly-Wijaya Hanly-Wijaya commented Jun 11, 2021

I kinda gave up. I'm a noob with this and its just giving errors and wasting time so I'm going to pass sadly. Would of been cool to see the new 3D buildings but guess not.

@alex99r

This comment has been minimized.

Copy link

@alex99r alex99r commented Jun 12, 2021

pretty incredible maps tbh. Didn't expect to be impressed but its a v good job by Apple.

BTW incredible findings. Hope we can have more of that "restricted" stuff.

@Hanly-Wijaya

This comment has been minimized.

Copy link

@Hanly-Wijaya Hanly-Wijaya commented Jun 12, 2021

Download the file and put file on Desktop.
Open Terminal and navigate to Desktop cd Desktop
You must have Xcode Command Line Tools installed. Use xcode-select --install to install them if you don't already have them installed.
Next, run the following commands one at a time (paste and hit Enter):

  1. clang -shared -fmodules -o libmaps_inject.dylib maps_inject.m \
  2. "$(xcrun --show-sdk-path)/System/Library/PrivateFrameworks/GeoServices.framework/GeoServices.tbd"
  3. cp -a /System/Applications/Maps.app ./
  4. codesign --remove Maps.app/Contents/MacOS/Maps
  5. DYLD_INSERT_LIBRARIES=./libmaps_inject.dylib Maps.app/Contents/MacOS/Maps
    At this point Terminal should start doing stuff and Maps should open up.

Hope this helps

Thanks! This helped a lot. It works for me.

These instructions create a new Maps.app on the Desktop which is patched. The author of the gist mentioned that it was possible to instead patch the stock Maps.app in /Applications, instead of making a second one on the Desktop. Given that I have SIP disabled, how would I go about patching the stock Maps.app instead?

Also, the patched Maps.app on the Desktop, which this process creates, quits on open when double clicked to open. To launch it, I must re-run the final Terminal command. Is there a way to have the final Maps.app launch without crashing with just a double-click, without using Terminal to launch each time?

Thanks very much for your help!

Hey, did you get any errors and how did you fix the errors if you got them? thanks.

@notnotjake

This comment has been minimized.

Copy link

@notnotjake notnotjake commented Jun 12, 2021

Hey, I keep getting this error. Do you know what to do? Thanks.

hanlywijaya@Hanlys-iMac Desktop % clang -shared -fmodules -o libmaps_inject.dylib maps_inject.m \

Undefined symbols for architecture x86_64:
"_GEOConfigGetBOOL", referenced from:
_wdb_GEOConfigGetBOOL in maps_inject-545e35.o
__interpose_GEOConfigGetBOOL in maps_inject-545e35.o
(maybe you meant: _wdb_GEOConfigGetBOOL)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Hey @Hanly-Wijaya! Sorry you're having trouble. Unfortunately I don't really know enough to understand fully what that error could mean, but here's one thought:
Did you install a fresh copy of MacOS Monterey or migrate from an existing account? I'd try to start from a fresh install of Monterey and see if it works.

@zhuowei

This comment has been minimized.

Copy link
Owner Author

@zhuowei zhuowei commented Jun 12, 2021

@Hanly-Wijaya are you using the Xcode 13.0 beta? You'll need it.

(I would post a pre-patched Maps.app, but don't want to get into trouble with copyright)

Here's a precompiled dylib if you can't get Xcode working: https://drive.google.com/file/d/1M2pRFCwHrzlqvfLSCaSH6sVlF6aXw6SQ/view?usp=sharing

@notnotjake

This comment has been minimized.

Copy link

@notnotjake notnotjake commented Jun 12, 2021

These instructions create a new Maps.app on the Desktop which is patched. The author of the gist mentioned that it was possible to instead patch the stock Maps.app in /Applications, instead of making a second one on the Desktop. Given that I have SIP disabled, how would I go about patching the stock Maps.app instead?

Also, the patched Maps.app on the Desktop, which this process creates, quits on open when double clicked to open. To launch it, I must re-run the final Terminal command. Is there a way to have the final Maps.app launch without crashing with just a double-click, without using Terminal to launch each time?

2 Options: You can patch the System Maps app in /Applications or you can automate the final command with an Automator Application, a Shortcut or any number of other automation tools for Mac. This automation option is preferable for anyone who doesn't want to turn off SIP.

Patch the System Map App:

System Integrity Protection (SIP) must be turned off.

Assuming you've done steps 1 & 2 from the previous instructions to compile, run the following commands:
4. cd /
5. cd Applications
6. codesign --remove Maps.app/Contents/MacOS/Maps
7. DYLD_INSERT_LIBRARIES=../Users/YOUR_USER/Desktop/libmaps_inject.dylib Maps.app/Contents/MacOS/Maps where YOUR_USER is replaced by your user name, such as ../Users/Jake/Desktop

I have not tried this as I don't have SIP turned off, but it should work

@alex99r

This comment has been minimized.

Copy link

@alex99r alex99r commented Jun 12, 2021

when you turn SIP on it restores the default version? Thx!

@Hanly-Wijaya

This comment has been minimized.

Copy link

@Hanly-Wijaya Hanly-Wijaya commented Jun 12, 2021

@Hanly-Wijaya are you using the Xcode 13.0 beta? You'll need it.

(I would post a pre-patched Maps.app, but don't want to get into trouble with copyright)

Here's a precompiled dylib if you can't get Xcode working: https://drive.google.com/file/d/1M2pRFCwHrzlqvfLSCaSH6sVlF6aXw6SQ/view?usp=sharing

Yup, I used Xcode 13 beta. I'll try the file you linked! Hope it goes well!

@Hanly-Wijaya

This comment has been minimized.

Copy link

@Hanly-Wijaya Hanly-Wijaya commented Jun 12, 2021

@Hanly-Wijaya are you using the Xcode 13.0 beta? You'll need it.
(I would post a pre-patched Maps.app, but don't want to get into trouble with copyright)
Here's a precompiled dylib if you can't get Xcode working: https://drive.google.com/file/d/1M2pRFCwHrzlqvfLSCaSH6sVlF6aXw6SQ/view?usp=sharing

Yup, I used Xcode 13 beta. I'll try the file you linked! Hope it goes well!

It worked! Thank you!!

@alex99r

This comment has been minimized.

Copy link

@alex99r alex99r commented Jun 15, 2021

any idea how to get SharePlay for FaceTime for intel-macs

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