Reputation: 116
I have created a python application and can install it perfectly fine on Windows. I run pyinstaller to generate the executable, and then use NSIS to create an actual installer. I run the installer and it installs the application to my Program Files folder and gives me a nice desktop shortcut, etc.
What is the process to do the same for Mac? Essentially, I want to give my user a single file. When they run the file, it installs my program and any necessary libraries, and let's them launch it with a single click. I believe on Mac this is done with a .dmg or a .pkg file. What software/tools do I need to generate such a file? Do I need to restructure the project in anyway to create this?
For more info, pyinstaller creates a folder 'dist' which contains the unix executable of the application, and copies of python and any required libraries.
Note that I do not want to use the onefile option for pyinstaller because it would take a while to unpack everything each time the program is ran.
Upvotes: 2
Views: 327
Reputation: 1
From a windows I don't know, But if you have a macOS available, You have to create a .spec file (auto-created with pyinstaller or manually) like this one :
# -*- mode: python ; coding: utf-8 -*-
a = Analysis(
['PYTHONSCRIPT.py'],
pathex=[],
binaries=[],
datas=[('lib', '.')],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='App Name',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=['logo.icns'],
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='App Name',
)
app = BUNDLE(
coll,
name='App Name.app',
icon='./logo.icns',
bundle_identifier=None,
)
You will maybe not need all argument, adapt to your usage. Finally, launch pyinstaller with option you need.
Best :)
Upvotes: 0