How can one run many copies of a MacOS App - macos

I was thinking of this today and was wondering what is it on MacOS app that prevent me from running, for example, 5 instances of a specific app?
I was thinking it could be the bundle_id (similar to iOS) but when I copied and renamed the app (to appname_2) edited the bundle_id (to bundle_id_2) for that specific app it didn't launch and instead just put that application in the foreground.
Maybe there's a method that checks the Mac address of the device and only allows one app to run per Mac address.
Due to it being hard to find and info on this online, wondering if it's possible to run multiple versions of an app on my Mac.
I'm pretty sure a virtual machine would work but if I wanted to run 100 instances of that specific app then id run all out of ram and would render my Mac useless for actual work.

The LaunchServices (Finder, NSWorkspace APIs, etc.) on MacOS allow you run one app per user session. Nothing prevents you from launching an app a second time when you don't use Launch Services. (And your assumption is correct that LaunchServices looks at the BundleID to see if the app is already running).
e.g. when you open two Terminal windows and start Mail via (/Applications/Mail.app/Contents/MacOS/Mail) in both you have two Mail instances. open /Applications/Mail.app/ won't work two times because it'll use LaunchServices.

Related

Run .sh on mac remotely from server

Not sure how clear the title is, but basically I've created a program for Windows which my company can use to build games remotely from their desktops. Currently the Windows aspect works without a hitch, but I'm struggling to get our Mac to build.
We use psexec for the Windows side, and I tried to use it for Mac as well (just hoping), to be stuck with an Invalid Handle error.
The way the program works is the user selects from their system tray what they want to build, we have two options that require the Mac, both of those currently are the only ones that don't work.
We do have the ability to remotely access the Mac as well, but we're looking to mostly automate the process so that literally anyone (even the non-technically savvy) can click two buttons and create a build.

Sandboxed Mac app does not always launch automatically using SMLoginItemSetEnabled()

I have a very strange issue with a sandboxed Mac app I'm developing. One requirement is that the user should have the possibility to launch the app when the system starts. For this, I'm using SMLoginItemSetEnabled() as described on http://blog.timschroeder.net/2012/07/03/the-launch-at-login-sandbox-project/.
When the user starts the app for the first time and enables this option, I can see an entry is being added to launchctl by using launchctl list. When I reboot the system, the app is not being started. More strange is the fact that the entry found using launchctl list has disappeared. However, a similar entry is still available in /private/var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist with key Disabled being false.
When I start the app manually and again set the option to start automatically, the entry is again available in launchctl list. When I reboot the system the app is being launched automatically. Concluding, for some reason SMLoginItemSetEnabled() only works the second time I run the app. Therefor it looks similar to this issue: https://stackoverflow.com/questions/16354295/sandbox-app-with-loginitems-only-work-after-second-app-launch. However, no solution is provided.
https://stackoverflow.com/questions/16354295/sandbox-app-with-loginitems-only-work-after-second-app-launch
If you're like me, you probably had extra copies (generated by Xcode, etc) laying around that seem to confuse LaunchServices.
I wrote a post about it here: Login Items in macOS 10.11 and newer
But the short version is, use lsregister -dump to find all copies that LaunchServices knows about, remove them, then use lsregister -kill to reset the LaunchServices database when you're done.

Detecting and launching an external application from within a Windows Phone 7.1/7.5 application

I need to write an application that can detect if the "Bing - Get me there" application is installed on the current phone and if so, launch it.
Is this possible? The app would need to do this for other external applications as well, so a generic method or interface for this would be helpful.
Applications run in a sandbox on Windows Phone and there is no way to tell if other applications are installed unless you are writing both of them and you use a method to announce to other applications that you are installed and they know how to read that announcement.
2 approaches to such announcements would be:
Have both (all) apps synchronise with a web server and report which devices they have been installed on. The apps can the query which other apps have been installed on that device.
Have all apps write a file to a location where all apps can access. The only place to do this is the PicturesLibrary so you have to embed the identifier in the name of the image or in its contents and be able to query all images to identify the other installed apps. The user could manually delete any images you create in this way though.
Beware, neither method can tell if the other app has subsequently been uninstalled though so this is far from foolproof.
As far as I know, there's no way to do that.
Applications on Windows Phone run in complete isolation, and can not act with other applications, other than some highly specialized apps (i.e. for playing media).

Run multiple instances of the same application (Firefox, Opera, etc.) on Mac OS X?

I know that I can do this via profiles in Firefox, but is there a simple way to set this up for multiple applications quickly and in an automated fashion, or a more general way for generic applications? I could have sworn there was a shareware utility that did this, but after a half hour of google searches I haven't been able to locate anything.
I need to be able to run multiple copies of the same application rather than multiple windows in order to test websites while doing other work (and keeping my personal browsing separate).
I'm running Lion.
You can launch multiple instances of an app by using Terminal, but you have to launch the application binary which is in the Contents/MacOS/ folder
Launch Terminal then enter this command:
/Applications/Safari.app/Contents/MacOS/Safari &
It will launch a new instance of Safari.
But for Firefox, this trick will not work since Firefox will complain that it could be only one instance running at the same time. Other applications, like iTunes, will control this themselves as well to limit you to only one instance running at a time.
I bet that the shareware utility you had in mind is SwitchUp, formerly named rooSwitch.

How to locate and launch other apps within an app on Mac

I'm new here and also new to Mac Programming.
I want to launch an app or get its url within another app.
However,I don't know how to implementing this program without monitoring the processes.
The problems are:
1.An app can be installed every where.
2.A process can be a system service.
If the question isn't clear enough, please get me noticed.

Resources