Codesign without xcode - error code object is not signed at all - macos

I have a macOS .app developed in a non-xcode tool. I want to sign it, so users can download from my website.
I have manually created my "info.plist" file which looks like this:
<?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>English</string>
<key>CFBundleExecutable</key>
<string>mydemo</string>
<key>CFBundleName</key>
<string>md</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.company.mydemo</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>md</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFBundleIconFile</key>
<string>mydemo.icns</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>*</string>
</array>
<key>CFBundleTypeOSTypes</key>
<array>
<string>fold</string>
<string>disk</string>
<string>****</string>
</array>
</dict>
</array>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
I have an Apple developer account and in
https://developer/apple/account/mac/certificate followed instructions for creating a Developer ID application certificate.
I am now doing this
codesign -s "Certificate Developer ID Company Name" mydemo.app
but get error
mydemo.app: code object is not signed at all In subcomponent:
mydemo.app/Contents/info.plist
My .app file does noy contain in additional lib - just executable mydemo.app/Contents/MacOS/mydemo
I would like to successfully sign mydemo.app. I distribute my app in mydemo.zip and my goal is that when people download. unzip and drag it into /Applications it will run more easily

The info.plist filename should be capitalized:
Info.plist
It should codesign without issue after correcting it.

Related

Why is xcrun returning 'missing Info.plist'?

I am trying to upload a mac app to the Apple store but xcrun altool gives the following error:
Error: ...The package is missing an Info.plist or the CFBundlePackageType is not ‘APPL’ or ‘FMWK’...
The app bundle contains Info.plist with the CFBundlePackageType set to APPL (see below). The app is created by Tauri and signed with my Apple distribution certificate.
How do I fix this and upload my app?
Command:
xcrun altool --upload-app --file "my-app.app" --type macos -u "my-id" -p "my-password"
Error:
2023-01-17 18:14:51.476 *** Error: Error uploading 'my-app.app'.
2023-01-17 18:14:51.476 *** Error: Could not determine the package’s bundle ID. The package is missing an Info.plist or the CFBundlePackageType is not ‘APPL’ or ‘FMWK’. Unable to validate your application. (-21017)
{
NSLocalizedDescription = "Could not determine the package\U2019s bundle ID. The package is missing an Info.plist or the CFBundlePackageType is not \U2018APPL\U2019 or \U2018FMWK\U2019.";
NSLocalizedFailureReason = "Unable to validate your application.";
}
my-app.app/Contents/Info.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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>My App</string>
<key>CFBundleExecutable</key>
<string>My App</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>CFBundleIdentifier</key>
<string>my.site.my-app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>My App</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>20230117.230842</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
<key>LSRequiresCarbon</key>
<true/>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2023</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key></key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>

Make an app (OSX) be able to be used in "open with" submenu

I made an application with Unity for OSX to open and modify images. Now, I want to be able able to open a file with it by using "open with". I managed to make the app appear in that submenu, but it won't open : I get an error from the os saying my app can't open the file. I really don't know why, I have no background whatsoever in OSX, and I didn't find any help on the web.
My goal is to retrieve the path of that file looking into the command line's arguments.
This is how the info.plist looks like :
<?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>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>StereoMacBuild</string>
<key>CFBundleGetInfoString</key>
<string>Unity Player version 2017.3.1f1 (fc1d3344e6ea). (c) 2018 Unity Technologies ApS. All rights reserved.</string>
<key>CFBundleIconFile</key>
<string>PlayerIcon.icns</string>
<key>CFBundleIdentifier</key>
<string>com.Company.ProductName</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<key>CFBundleName</key>
<string>StereoProto</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>0</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>PlayerApplication</string>
<key>UnityBuildNumber</key>
<string>fc1d3344e6ea</string>
<key>LSMinimumSystemVersion</key>
<string>10.9.0</string>
</dict>
</plist>
Thanks to anyone taking some time to help me !

Open existing file in OSX with RCP and register file type

I'm working on installers for a tool written in Java/Ecipse RCP and everything is working except two things I think could be related:
1) Open existing file. For some reason OSX doesn't provide the selected file as an argument like windows and linux does. How do I get osx to pass the path as an argument? or is there another way?
2) File type doesn't register properly. Double clicking an existing file with the extension opens the application as expected, but when I go "Open with" - "Other" the tool is greyed out, how do I make osx understand that the tool can open such files?
Here's the current Info.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>CFBundleIconFile</key>
<string>images/icons/macos.icns</string>
<key>NSHumanReadableCopyright</key>
<string>2016 Company</string>
<key>CFBundleGetInfoString</key>
<string>Tool description</string>
<key>CFBundleShortVersionString</key>
<string>1.2.0</string>
<key>CFBundleVersion</key>
<string>1.2.0</string>
<key>CFBundleDisplayName</key>
<string>Tool</string>
<key>CFBundleName</key>
<string>com.company.tool</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleExecutable</key>
<string>tool</string>
<key>CFBundleIdentifier</key>
<string>com.company.tool</string>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeIdentifier</key>
<string>com.company.tool.extension</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>ext</string>
</dict>
<key>UTTypeIconFile</key>
<string>images/icons/macos.icns</string>
<key>UTTypeDescription</key>
<string>tool file</string>
</dict>
</array>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<string>images/icons/macos.icns</string>
<key>CFBundleTypeName</key>
<string>tool file</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.company.tool.extension</string>
</array>
</dict>
</array>
</dict>
</plist>

“Could not find a CFBundlePackageType” within the Info.plist using Application Loader

So im trying to upload an App for Mac OS X to the App Store using Application Loader. When I open Application Loader (version 3.5), I double click on "Deliver App", select MyApp.pkg and the following message appears:
"Could not find a CFBundlePackageType within the Info.plist; or the package is missing an Info.plist."
I´ve already searched for this error in Apple Forums and other posts in here and other forums and still can´t get it right. I checked the Info.plist in the contents of MyApp but, I think, everything is alright.
Info.plist:
<?xml version=“1.0.0” encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.0.dtd">
<plist version=“1.0.0”>
<dict>
<key>BuildMachineOSBuild</key>
<true/>
<key>CFBundleDisplayName</key>
<string>Nimbo X</string>
<key>CFBundleExecutable</key>
<string>Nimbo X</string>
<key>CFBundleIconFile</key>
<string>electron.icns</string>
<key>CFBundleIdentifier</key>
<string>com.ecaresoftinc.nimbox</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Nimbo X</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>DTSDKBuild</key>
<string>14D125</string>
<key>DTSDKName</key>
<string>macosx10.10</string>
<key>DTXcode</key>
<string>0640</string>
<key>DTXcodeBuild</key>
<string>6E35b</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
<string>10.9.0</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>AtomApplication</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
</plist>

CFBundleTypeIconFile Icon not showing for given file extension

I have the following Info.plist for my application, the problem is files i save with the extension myapp do not seem to pick up on my MyApp icon which i have created from an icon set (application correctly uses icon) so guessing there is something wrong in the plist.
I am assuming if I got this working when running my application at some point documents that I have save will suddenly show with the given icon.
Incase this matters, the document is saved from a set of NSCoder based classes. Clicking these documents also opens my application and loads the file correctly, so confused what I am missing to get Icon to show on the files....
<?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>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>myapp</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MyApp</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>ASWM</string>
</array>
<key>CFBundleTypeName</key>
<string>MyApp project file</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>MyApp</string>
<key>CFBundleIdentifier</key>
<string>com.workmonkeys.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>ASWM</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012 Me. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
Turns out the system must have cached a old copy of the plist when I initially created my application. All that was needed was to rebuild the launch services database.
I used the lsregister command as documented here...
http://www.tuaw.com/2009/06/11/terminal-tips-rebuild-your-launch-services-database-to-clean-up/
Rerun the application and bingo the documents now have the respective icon associated.

Resources