Create a MacOS app without Xcode

Create a MacOS app without Xcode

https://stackoverflow.com/a/53641189/29245654

mkdir MyApp
cd MyApp
swift package init --type executable
# swift build -c release
swift build

mkdir MyApp.app
cd MyApp.app
# cp ../.build/release/MyApp main
cp ../.build/debug/MyApp main
# cp /System/Applications/FindMy.app/Contents/Resources/AppIcon.icns AppIcon.icns # you can change it later
touch AppIcon.icns
touch Info.plist

Copy following content to your Info.plist, change your strings when neccessary

<?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>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>MyApp</string>
    <key>CFBundleExecutable</key>
    <string>main</string>
    <key>CFBundleIdentifier</key>
    <string>hangj.cnblogs.com.MyApp</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>MyApp</string>

    <key>CFBundleIconFile</key>
	<string>AppIcon</string>
	<key>CFBundleIconName</key>
	<string>AppIcon</string>

    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1</string>

    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
</dict>
</plist>

posted on 2025-08-05 21:55  明天有风吹  阅读(8)  评论(0)    收藏  举报

导航

+V atob('d2h5X251bGw=')

请备注:from博客园