Code Monkey home page Code Monkey logo

codesign's Introduction

Start

If you use a smart card or a flash card to confirm your authenticity on your Mac, then you may have problems deploying the program from Xcode to the real device. In my everyday life, it happens that I work remotely through a VPN connection. I use a flash stick on which keys are stored for my authentication. It should be plugged into the connector almost constantly. Xcode building for devices was failing each time. The error was specified item could not be found in the keychain. To be honest, this message does not seem exhaustive to me.

TL;DR the solution was found here

There is one way to get around this problem, remove the flash drive with certificates before compiling the program. But this is an extremely inconvenient solution, you quickly get tired of doing that.

And so, why is this happening... The problem is you need several code sign operations for the build process . One operation does not have time to complete successfully as the others already begin. Other operations simply end their work with an error. So as cstar said kindly, we need to create a wrapper over /usr/bin/codesign to be sure that there is only one codesign operation running at a time.

Here are the step-by-step instructions on how to do this:

Step one

You need to temporarily disable System Integrity Protection. We need that to copy /usr/bin/codesign file to /usr/bin/codesign.orig and change it's rights.

Restart your mac and keep holding CMD+R to enter to recovery mode, then select in the top menu Utilities and then Terminal.

Type terminal command : csrutil disable. Reboot you computer again.

If you want more information about SIP on your Mac, you can read it here .

Step two

Open Terminal and go to /usr/bin. For example by typing cd /usr/bin. You will need to rename codesign utility to, for example codesign.orig. Type in the terminal sudo cp codesign codesign.orig. Exactly what to do this you had to turn off SIP on your Mac.

Step three

Remove codesign utility by doing sudo rm codesign. Go ahead, you have already copied the original file to codesign.orig.

Instead of a deleted file, create an empty codesign file. Using your favorite text editor, copy the proposed script. Don't forget to sudo when opening the file with your text editor sudo emacs codesign.

Step four

We should make executable the created file. To check its current permissions you can type something like ls -l codesign. And the add -rwxr-xr-x by doing sudo chmod 755 codesing.

If you want read more about how to set file permission here is a good atricle .

Step five

The SIP can be activated again. Repeat the step one but this time type in terminal csrutil enable.

Voila!

Troubleshooting

If you got something like a command /bin/sh failed with exit code 126, it probably means you forgot step four, so just apply to the codesign file chmod +x

codesign's People

Contributors

ksimagin avatar

Watchers

 avatar James Cloos avatar

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.