Hello all,

I'm using PyInstsaller to package a command line application into a single 
executable binary file. I'd like to codesign the application so that when a 
user double clicks the executable, Terminal opens and runs the command and 
the program exits, leaving the command output up in Terminal. This is the 
default behavior of a Unix executable binary on Mac OS and that's how my 
app works on my computer when it's created with PyInstaller.

When I transfer the app to another computer, double clicking the app 
results in a "This file is damaged and should be moved to the Trash." 
message. When I run the program from the command line using Terminal, it 
works great.

Basically, I'd like to give other users the same ability to double click 
the app and see the output, just like I have on my computer – and I thought 
I'd have to codesign the binary to do that.

I found a thread or two on this list with similar questions but no 
conclusive answers. It seems one person was able to codesign a Mac 
application bundle, but their program was not a command line tool, and it 
also used the "--onedir" flag and not the "--onefile" flag like I am.

Here's my question: *Is there a conclusive way to codesign a "--onefile" 
Unix executable application for Mac?* I am unable to do this. If not, would 
anyone have a recommendation on how to distribute a Python command line 
executable tool on Mac?

Here are my steps that fail:

$ pyinstaller grow.spec
$ codesign -f -s "Developer ID Application: Jeremy Weinstein (<developer id 
here>)" --entitlements ./entitlements.plist --deep dist/grow
dist/grow: replacing existing signature
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate:
 
the __LINKEDIT segment does not cover the end of the file (can't be 
processed) in: /Users/jeremydw/git/macgrow/dist/grow
dist/grow: the codesign_allocate helper tool cannot be found or used

*grow.spec:*

# -*- mode: python -*-
a = Analysis(['pygrow/bin/grow'],
             pathex=['pygrow/', '/Users/jeremydw/git/macgrow', 
'/Library/Python/2.7/site-packages/'],
             hiddenimports=['markdown', 'markdown.extensions'],
             hookspath=None,
             runtime_hooks=None)
a.datas += [
    ('VERSION', '/Users/jeremydw/git/macgrow/pygrow/grow/VERSION', 'DATA'),
    ('server/templates/error.html', 
'/Users/jeremydw/git/macgrow/pygrow/grow/server/templates/error.html', 
'DATA'),
]
pyz = PYZ(a.pure)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          name='grow',
          debug=False,
          strip=None,
          upx=True,
          console=True,
          icon='macgrow/icon.icns')

*entitlements.plist*

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
  <dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.inherit</key>
    <true/>
  </dict>
</plist>

Thanks for any tips you might have!

-- 
jeremydw

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.

Reply via email to