Spotlight Indexing of Apps Built from Scripts

apizz
Valued Contributor

I've begun testing a number of things I've been working on this year for deployment on our image next year. This includes an OS X application which I created which simply runs a shell script to mount the logged in user's network home folder on the Desktop.

I used Appify to create the app, however when I try and launch it via Spotlight it does not appear under Applications even though the app is in the Applications folder. I assume my method of creating the app is what's preventing it from being visible & indexed by Spotlight ...

Does anyone know what the requirement(s) are for Spotlight to index an application so I can add this to piece to the app I've already built so Spotlight can see it and index it?

OS X 10.11.4, almost a complete base OS not including my app/script, and the Spotlight Applications checkbox is checked.

Thanks in advance!

2 ACCEPTED SOLUTIONS

apizz
Valued Contributor

Added an Info.plist file to the Contents directory in the app with some basic info I gathered from other Info.plist files from installed apps and Spotlight seems to index it and have it appear when searching.

This was ultimately what I used in the Info.plist file if it's helpful to anyone.

<?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>Panther</string>
    <key>CFBundleExecutable</key>
    <string>Panther</string>
    <key>CFBundleName</key>
    <string>Panther</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSupportedPlatforms</key>
    <array>
        <string>MacOSX</string>
    </array>
    <key>LSApplicationCategoryType</key>
    <string>public.app-category.utilities</string>
    <key>LSHasLocalizedDisplayName</key>
    <true/>
    <key>LSMinimumSystemVersion</key>
    <string>10.10</string>
    <key>NSPrincipalClass</key>
    <string>NSApplication</string>
</dict>
</plist>

View solution in original post

mm2270
Legendary Contributor III

You could also look at Platypus to create your app going forward, as it always includes a full Info.plist file. It also has a full GUI that lets you set everything about the application, and several default window and application styles you can choose from when creating the app. So its pretty flexible.
Anything I've ever created using it becomes Spotlight indexable, so there's no issues there.

View solution in original post

4 REPLIES 4

apizz
Valued Contributor

Added an Info.plist file to the Contents directory in the app with some basic info I gathered from other Info.plist files from installed apps and Spotlight seems to index it and have it appear when searching.

This was ultimately what I used in the Info.plist file if it's helpful to anyone.

<?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>Panther</string>
    <key>CFBundleExecutable</key>
    <string>Panther</string>
    <key>CFBundleName</key>
    <string>Panther</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSupportedPlatforms</key>
    <array>
        <string>MacOSX</string>
    </array>
    <key>LSApplicationCategoryType</key>
    <string>public.app-category.utilities</string>
    <key>LSHasLocalizedDisplayName</key>
    <true/>
    <key>LSMinimumSystemVersion</key>
    <string>10.10</string>
    <key>NSPrincipalClass</key>
    <string>NSApplication</string>
</dict>
</plist>

mm2270
Legendary Contributor III

You could also look at Platypus to create your app going forward, as it always includes a full Info.plist file. It also has a full GUI that lets you set everything about the application, and several default window and application styles you can choose from when creating the app. So its pretty flexible.
Anything I've ever created using it becomes Spotlight indexable, so there's no issues there.

bentoms
Release Candidate Programs Tester

FWIW, AppleScript Apps also have the info.plist.

If Appify is missing the info.plist, I'd suggest logging a bug/issue with them to correct that.

apizz
Valued Contributor

Thanks for suggesting Platypus @mm2270 it looks a lot closer to what I'm looking for. Good to know for future stuff!

@bentoms my understanding of the Appify python script is to make as thin of an app as possible, so it literally just creates the app wrapper with a Contents folder and an executable for the script. So in this case I don't think a bug report would be appropriate. But thanks for the suggestion.

I originally went with your AppleScript app method for our network mount script this past year, but since our machines are bound to AD, I found a script that @davidacland made (which I modified slightly) which rather than querying AD group membership to determine the network folder to mount does this via the dscl command and instead of mounting the root network folder mounts the user's home folder.