How to tell finder that my application is installed? - macos

I am working on a cocoa application. I see a strange behaviour on Mac OS 10.6.8..!
My Cocoa application has an Automator action inside it. I want it to be listed in Automator as soon as I install it.
The conditions are as follows:
1. After installation, user should not go to the installed path.
2. User should not launch the application.
I mean, I am seeing this bug only for above mentioned situations. If I go to the installed folder, or launch the application, the automator app gets listed.
I didn't see this defect on Mac OS 10.7.5 or Mac OS 10.8.2..
Also I tried touch command via terminal just in case thinking that if any kind of Access updating is required and all. But that wasn't the case.
Any suggestions? Can I run any kind or Shell/Applescript while installing [After installation of the application] so that I can list the automator action in automator?
Any advice or help would be great!!

You can have a .txt file with the below script and then you have to add postflight script when taking .pkg file in Package Maker.
open "/Applications/yourAppName.app"

Try this Terminal command.
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister .../Whatever.app
You shouldn't hard-code the path, though, as users sometimes stick apps in weird locations (citation: I do it :).

Related

Mac app installed in unknown place on developer's machine

I'm developing a Mac Electron-based app. When I install the electron-builder generated pkg on Macs others than my development machine, it is installed either globally in the /Applications folder, or locally for the user - based on the user's choice during installation. It also appears properly in the Launch Pad.
However, on my development machine, when I install the app from the same pkg, it is not installed there. It is installed somewhere else - and I'm not sure where. It may be the last place where I compiled the app, but I am uncertain. Launch Pad is also uncertain, and most of the times the app does not appear there after installation.
It is obvious the Mac is keeping track of a default installation folder for each application, which for some reason overrides the user selection during installation.
Where is this taking place, and how can I reset it so the Mac app is installed where it should? It makes testing a real pain.
You can either search for the app using Spotlight search
⌘ + Space-bar
And then hold they command key after you select your app int the spotlight seach.
A bar with the location of the file will appear at the bottom of the spotlight search window.
Path for the application
Or you could search for it using the find command on terminal.
find / -name YourApp.app

What is the difference between launching a Mac OS X app via the Finder/open and executing the app binary directly?

I'm experiencing an issue with a Qt app on Mac OS X 10.10.5, whereby a QFileDialog will not close properly when canceled. While this may be a bug in Qt, I only see this bug when running the app as a normal user would, e.g. opening it in the Finder (or via command line open). If I launch the app via Xcode or by calling the binary directly, there is no issue.
Launch the app via calling the binary directly on the command line or within Xcode, e.g. ./MyApp.app/Contents/MacOS/MyApp
Launch the app via the Finder or open, e.g. open ./MyApp.app
What are the differences between these two methods - and how does it impact a running application?
The major difference is the working folder. You don't have any control over what it is, but it will be different between the two invocations.
What directory are you showing the QFileDialog in? You should probably start in a well-defined place, like the user's home.

PyInstaller OS X app runs from command line, but not Finder window

I have an application bundle created with PyInstaller on OS X. If I double click the .app bundle in Finder, the application tries to launch, then terminates. No further information is given in the console, other than the application quit.
But if I launch the app executable from the terminal (i.e., ./Contents/MacOS/MyApplication, it works perfectly fine. This seems to be the same behavior experienced in this issue: OSX app built with python quits immediately if app bundle is executed from finder but runs fine from command line, but the marked solution there isn't particularly helpful.
I suspect this is indeed related to an environment or path issue. But I'm not sure how to fix it. Should something be specified in the info.plist file maybe? Any guidance would be greatly appreciated.
This is most likely due to a bad assumption about the working directory. When you launch from the Finder, the working directory may well be / (depends on OS X version), which is not writeable. If your app writes to the current working directory then you should probably set the working directory to somewhere sensible at startup.

Ruby Shoes won't start in Leopard

So I wanted to try doing some easy Ruby GUI programs using Ruby Shoes. I downloaded Shoes 3 for OS X, opened the dmg and installed it to the Applications folder. When I click on the icon in the folder, or drag a source code file to it, the icon briefly appears in the dock and bounces, and then disappears without anything running. So I can't use it. The computer I'm trying to run it on is running Leopard - is that the problem?
Have you tried building shoes 4? You might want to check it out, and check the readme. I can confirm it working on my 10.6 mac, which is about as close to leopard as you can find. Just try the directions for *nix and it should work, as far as I know.

Why does my Firemonkey app open a terminal window on OSX but not on Win32?

I created a simple testbed app in Delphi XE2, and compiled both a Win32 and OSX version of the application.
I zipped up the OSX version, along with a copy of the libcgunwind dylib runtime file and copied this files to a Mac i have access to.
When I unzipped the file, the mac recognized my OSX application and I double clicked it.
This, in turn, opened up a terminal window for some unknown reason along with my simple app's form.
The application itself ran and behaved just fine, but I'm curious why a terminal window would open up on the Mac?
There is a free tool available for Delphi XE2 that will create the OSX deployment app bundle for you, from Windows, without the need for PAServer.
http://enesce.com/delphiosx_bundler
Check the readme for instructions.
IIRC this happens if you execute the binary directly instead via a bundle
Lazarus/FPC apps had the same problem. IIRC the directly executed binary also didn't get events under those circumstances, but those apps were Carbon based. That problem also went away when running via a bundle setup (which is pretty much a manifest, a few dirs and a symlink)
Your application needs to be run from the application bundle. If you run it directly, you'll get the side effect of seeing the terminal window with the command line that is running the application.
You'll want to read more about Application Bundles.
If you're using PAServer, after you run the program for the first time on the Mac, look in the following folder on the Mac for the application bundle:
/Users/[username]/Applications/Embarcadero/PAServer/scratch-dir/[profilename]
If your project is named Project1, you'll see an application bundle in that folder named Project1.
If you read the above wiki article, you'll know that Project1 has a "hidden" extension of .app, and the whole thing is really a folder with all of the required files to run the application.
To the Mac OS user, the application bundle appears as a single program file, complete with an icon. The user can double-click the application bundle to run the application, drag it to their dock, etc.
The application bundle will have the Delphi icon by default, but you can replace it with your own icon. On the Mac, simply right-click on the application bundle in Finder, and select Show Package Contents. In there, look in the Contents/Resources folder for the .icns file.
Use the Icon Composer application that was installed with XCode to create your .icns icon file from existing image files.
Peek around inside at the rest of the contents. You'll see the required dylib, your program file, and the Info.plist file, which is a text file with things like application IDs, signatures, and other important things.

Resources