Skip to content

Instantly share code, notes, and snippets.

@jankais3r
Created November 23, 2015 21:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jankais3r/89187fde776aa57d9364 to your computer and use it in GitHub Desktop.
Save jankais3r/89187fde776aa57d9364 to your computer and use it in GitHub Desktop.
Outlook binary patching and signing

Simple shell script to quickly and easily force Outlook 2016 for Mac out of sandbox.

More info here.

See the script in action here.

#!/bin/bash
echo "Patching old binary... "
cd "/Applications/Microsoft Outlook.app/Contents/MacOS/"
hexdump -ve '1/1 "%.2X"' "Microsoft Outlook" | \
sed "s/73616E64626F783C2F6B65793E0A093C747275652F3E/73616E64626F783C2F6B65793E0A093C66616C732F3E/g" | \
xxd -r -p > "Microsoft Outlook.patched"
# hexdump -> creates hex dump of the binary executable
# sed -> replaces 'sandbox</key><true/>' with 'sandbox</key><fals/>' in the hex dump
# xxd -> rebuilds the edited hex dump back into executable binary
chmod `stat -f %A "Microsoft Outlook"` "Microsoft Outlook.patched"
# copies permissions from the original binary to the patched binary
mv "Microsoft Outlook" ~/Desktop/Microsoft\ Outlook.bak
# backs up the original executable
mv "Microsoft Outlook.patched" "Microsoft Outlook"
echo "Done!"
echo ""
echo "Proceed with signing the new binary:"
echo "sudo codesign -f -s \"CERIFICATE NAME HERE\" /Applications/Microsoft\ Outlook.app/"
# After the binary is successfully patched, sign it with the above command
echo ""
echo "Then verify that signing finished properly:"
echo "sudo codesign -v /Applications/Microsoft\ Outlook.app/"
# Verify the signature. If everything went smoothly, you won't get any output from the above command
# More info: https://ツ.sh/move-profile-folder-location-in-outlook-2016-for-mac/
# @jansoucek 2015
@rengui
Copy link

rengui commented Aug 27, 2019

@BourneLoser , @jankais3r,
I'm using Office 16.25 (macOS Mojave 10.14.5), by remove signature, I still can move profile folder location to other volume . (I'm using only one account, so, not re-sign is not a problem for me.)

  • disable Gatekeeper (sudo spctl --master-disable)
  • sudo codesign --remove-signature /Volumes/tfData/macInstalledSW/Microsoft\ Outlook.app/

@Lux-WorldPC
Copy link

Hello any update for Office 16.30 ?

@JanRobert60
Copy link

Hi,
I did the test with Outlook 2019. There is a crash like you described on April 2019.

@DuettoSG
Copy link

Dear Jan, while I managed to follow your instructions (moving the Outlook-folder to an external SSD and creating a SymLink instead of the Alias, that I did at first), when I open Outlook for Mac, it does not show me any of my accounts, meaning, I would have to start from Zero. And when I open the Outlook Profile Manager, it does not show me any of my profiles, neither "Main" nor the one, that I created and used ... and are now sitting on my external SSD. I do appreciate your work and thank you for it, but maybe there is/was something missing in your instructions? Kind regards, Alexander.

@DuettoSG
Copy link

Addendum, just FYI, if that helps: I just checked, that when I opened Outlook for Mac, there were two new files created in my (original) UBF8......Office-Folder: MicrosoftRegistrationDB.reg and OutlookProfile.plist. Maybe that helps you to let me know, what I might have done wrong or what might be missing in your instructions. Thanks again, Alexander.

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