Protect Source Code (macOS)
  • 15 Oct 2020
  • 1 Minute To Read
  • Print
  • Share
  • Dark
    Light

Protect Source Code (macOS)

  • Print
  • Share
  • Dark
    Light

After following this guide you will will become more familiar with how to build and sign Git with no memory mapping enabled (NO_MMAP=1).

Assumptions:

  • You have XCode Installed with Command Line Tools configured. This will provide us with a git we can use to get the latest official version as well as fulfill requirements to compile our own version correctly.
  • You have a certificate in Keychain to sign with
  1. Get the latest version of Git:
$ git clone https://github.com/git/git.git
  1. Make the configuration:
$ make configure (requires GNU Autoconf)

If the above command is successful, $ ./configure --prefix=/path/to/export/git_files/to

In the event the command above (a) fails, an alternative command may be used:

$ make prefix=/path/to/export/git_files/to 

/path/to/export/git_files/to - use the same path as defined in Step 2

  1. Build git (with memory mapping flag set to off):
$ sudo make prefix=/path/to/export/git_files/to NO_MMAP=1 install 

/path/to/export/git_files/to - use the same path as defined in Step 2

  1. Sign git using an existing certificate:
$ for f in path/to/exported/git_files/*; do codesign -s "cert_name" -i "cert_name" -f  $f; done
Was This Article Helpful?