# pywebview-py2app **Repository Path**: wavef/pywebview-py2app ## Basic Information - **Project Name**: pywebview-py2app - **Description**: 打包 pywebview 程序为 macOS 应用的范例工程, 已经在 macOS 15.6, Apple Silicon m1 max 64G 上测试过,没测过 Intel 版本 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-08-21 - **Last Updated**: 2025-08-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # pywebview - py2app Create standalone macOS application, tested on macOS 15.6, Apple Silicon m1 max 64G ## One Step ```bash uv sync uv run setup.py py2app # your app will be generated at ./dist/pywebview-py2app.app # Running it from the terminal will display log output (helpful for debugging errors): dist/pywebview-py2app.app/Contents/MacOS/pywebview-py2app ``` ## Manual If you want to make same project manually, follow these steps: ### 1. Install ```bash brew install libffi brew install openssl@3 uv init pywebview-py2app cd pywebview-py2app uv python pin 3.12.4 uv sync uv add setuptools \ wheel \ py2app \ pywebview \ rubicon-objc \ pyobjc-core==11.1 \ pyobjc-framework-Cocoa==11.1 \ pyobjc-framework-WebKit==11.1 \ pyobjc-framework-Quartz==11.1 \ pyobjc-framework-Security==11.1 ``` ### 2. Develop ```python # main.py import webview ... win = webview.create_window(...) ... webview.start() ``` ### 3. Setup ```python from setuptools import setup ENTRY_POINT = ['main.py'] OPTIONS = { 'resources': ['web'], # web directory 'argv_emulation': False, 'strip': True, 'includes': [ 'webview', 'rubicon.objc', 'objc', # add your modules here ], 'packages': ['objc', 'webview'], 'compressed': False, 'site_packages': True, 'excludes': [ 'rubicon', 'wheel', 'setuptools', 'pkg_resources' ], } setup( app=ENTRY_POINT, options={'py2app': OPTIONS}, setup_requires=['py2app'], ) ``` ### 4. Pack .app ```bash rm -rf build dist .eggs uv run setup.py py2app ```