Creating feature in mac app to override the users security setting - macos

I'm a newbie at mac osx development. I would like to know if there's any way to override the mac desktop security settings to allow an application - which is not registered in the Mac App Store, to be installed?
The setting should come from the app that I'm trying to install. That means, whenever I install the app to any mac computer, regardless of its security settings as the following,
Allow applications downloaded from:
Mac App Store
Mac App Store and identified developers
Anywhere
The app should set the settings to Anywhere, allowing it to be installed.
Any help would be very much appreciated.

Launch System Preferences from the Apple menu.
Choose “Security & Privacy” and then click the “General” tab, followed by clicking the lock icon in the corner to unlock the settings.
Look for “Allow applications downloaded from:” and choose “Anywhere”.
Accept the security warning and allow.
Note that you should be careful and aware that now the job of protecting the system from malicious apps belongs to you instead of the OS.

Right click the (app) icon and click 'open' in contextual menu - no need to disable the OS security.

This is not possible. The existence of that setting is intended to protect users from malicious executables. If there were a way for any arbitrary executable to override that setting, what protection would it offer? Malicious executables would simply change the setting to "Anywhere" like you suggest, bypassing the security features of Mac OS X.

You need to sign your application using a Mac Developer certificate, which you can obtain from Apple. That will mark your app as built by an "identified developer" and it will launch just fine without changing any settings.

Control Click the app icon to override this security feature. This is a one off, you don't have to change your settings, you can do it per-app.

There is one other way...
All you have to do to do it manually is to open up Terminal, cd into the .app application, cd into the Contents folder, then cd into the MacOS folder, then type ./YourAppNameHere and execute by typing Enter.

Related

Installing MagicDraw “libjvm.dylib” cannot be opened because the developer cannot be verified on mac M2 pro

I installed MagicDraw 190_sp3 on my mac but it couldn't be opened. When I try to open it shows the error that the developer couldn't be verified. Can anyone help me in this regard, please?
Is your macOS showing an error alert like below?
If so, your app is not signed and notarized.
If you’re certain that an app you want to install is from a trustworthy source and hasn’t been tampered with, you can temporarily override your Mac security settings to open it.
If you still want to open an app for which the developer cannot be verified, open System Preferences. Go to Security & Privacy. Make sure Allowed apps downloaded from is set to App Store and identified developers. Click the Open Anyway button in the General pane to confirm your intent to open or install the app.
The warning prompt reappears, and if you're absolutely sure you want to open the app anyway, you can click Open.
The app is now saved as an exception to your security settings, and you can open it in the future by double-clicking it, just as you can any authorized app.
See this KB from apple for details
Thanks for your answer kakaiikaka.
I did all of those steps but it was still showing the problem, then I found out the problem was with my JDK version on my JVM. So, I installed JDK version 8 and again tried to open this and it worked as a charm!

VPN System Extension blocked even though it's notarized, requires user open macOS System Preferences. Is it b/c the app is not on the mac AppStore?

I have an application that we're developing that provides VPN System Extension for macOS. I have successfully built, signed and notarized the app.
When we install the package the user sees this popup:
The program tried to load new system extension(s). If you want to enable these extensions, open Security & Privacy System Preferences.
However when I download an existing VPN app from the macOS AppStore I see this popup when the extension is being installed:
Why am I getting the blocked popup when my app has been notarized? Is it because it's not coming from the AppStore?
As far as I'm aware, VPNs implemented via the NetworkExtension Framework don't necessarily need to be installed as System Extensions. This is probably the distinction you're running into. You can check the list of all system extensions in the system using the following Terminal command:
systemextensionsctl list
0 extension(s)
If the "Turbo VPN" extension is not listed there, it was not installed using the OSSystemExtensionManager API.
Only system extensions need to go through the System Preferences user approval process.

Accessibility disabled for app in Mac OS X 10.9

After upgrading to Mac OS X 10.9 and running my app (which executes various AppleScripts as part of its execution) I get a dialog that the app has to be specifically enabled via the System Preferences Security/Privacy screen. So I do this and the app then functions properly.
However, when I recompile and build the app, it will no longer execute the AppleScripts and does not show the dialog. When I look in the System Preferences Security/Privacy I see that my app is still listed there but has been disabled (i.e. checkbox reset).
BY trial and error, I have found the following:
If you change the Bundle Version string in the apps info.plist and rebuild the app even without making any other changes such as code, etc this will happen; it will be disabled from accessibility.
If you make all kinds of changes to the app (code, resources, etc) but do not change the Bundle Version string in info.plist, it will still be allowed to have accessibility access.
My question is: is there a way to circumvent disabling after rebuilding?

Open app automatically at system startup in dock

I have a MAC OS X application and I want to launch my app automatically in the dock when user opens his PC. I know a user can explicitly select an app to "alway open on startup" but what if user dont select that option. Thats why I want to do it automatically (myself) once he/she install my app. Later he can remove my app from launching at the startup though. Kindly suggest me some solution or guide me to the right path. Not very familiar with Mac development.
Thanks.
Take a look at Daemons and Services Programming Guide. What you are looking for is an agent.

Mac OS X Services: enable without user interaction?

I wrote a simple Mac 'Service' for Finder, that executes a command.
Basically: this adds a ContextMenu in Finder.
If I right-click a file in Finder, a menu item pops up. If the user clicks it, it executes my script. (kind of like 'Send to Bluetooth device, ...')
In OS X Leopard (10.5) and earlier, all services are enabled.
In 10.6 (Snow Leopard), Apple changed the behavior, services now have preferences, and can be enabled or disabled by the user. (which is a good thing)
However, I wrote the service, but there seems to be no way to enable it automatically (in our installer).
I tried doing it with Applescript, going to the System Preferences and ticking the checkbox that way, but it requires some accessibility features to be turned on. (off by default).
Is it possible? If so, how?
Or do I need something else to provide Context Menus in Finder.
I tracked File changes on my filesystem while changing the preferences and discovered there was a plist file:
~/Library/Prefrences/pbs.plist
which contains what I need.
If I edit that manually, it seems to work. So, problem solved :)

Resources