obsproject / obsproject/obs-studio

mac-virtualcam: No easy way to uninstall system extension if app is removed without using Finder

Open
#9,714 25 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/ui-ux
Dominant language
C
Stars
76.4k
Forks
10.2k
Avg merge
4d 23h
Merged PRs (30d)
12

Description

Operating System Info

macOS 13

Other OS

No response

OBS Studio Version

30.0.0-rc1

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/YBw0Kw8hOZbeYFav

OBS Studio Crash Log URL

No response

Expected Behavior

mac-virtualcam plugin only provides the code that installs system extension but doesn't provide any way to uninstall it.
The previous DAL plugin can be uninstalled manually by users operations, but for the system extension,
the container app should provide the interface to do so by deactivationRequestForExtension API,
otherwise users can't remove it.

The expected code is like this (there is missing static in the code, by the way.)

diff --git a/plugins/mac-virtualcam/src/obs-plugin/plugin-main.mm b/plugins/mac-virtualcam/src/obs-plugin/plugin-main.mm
index 2bea96a30..8d2b65ada 100644
--- a/plugins/mac-virtualcam/src/obs-plugin/plugin-main.mm
+++ b/plugins/mac-virtualcam/src/obs-plugin/plugin-main.mm
@@ -13,7 +13,8 @@ MODULE_EXPORT const char *obs_module_description(void)
     return "macOS virtual webcam output";
 }
 
-NSString *const OBSDalDestination = @"/Library/CoreMediaIO/Plug-Ins/DAL";
+static NSString *const OBSDalDestination = @"/Library/CoreMediaIO/Plug-Ins/DAL";
+static NSString *const SystemExtensionIdentifier = @"com.obsproject.obs-studio.mac-camera-extension";
 
 static bool cmio_extension_supported()
 {
@@ -125,13 +126,22 @@ struct virtualcam_data {
 static void install_cmio_system_extension(struct virtualcam_data *vcam)
 {
     OSSystemExtensionRequest *request = [OSSystemExtensionRequest
-        activationRequestForExtension:@"com.obsproject.obs-studio.mac-camera-extension"
+        activationRequestForExtension:SystemExtensionIdentifier
                                 queue:dispatch_get_main_queue()];
     request.delegate = vcam->extensionDelegate;
 
     [[OSSystemExtensionManager sharedManager] submitRequest:request];
 }
 
+static void uninstall_cmio_system_extension(struct virtualcam_data *vcam)
+{
+    OSSystemExtensionRequest *request = [OSSystemExtensionRequest
+        deactivationRequestForExtension:SystemExtensionIdentifier
+                                  queue:dispatch_get_main_queue()];
+
+    [[OSSystemExtensionManager sharedManager] submitRequest:request];
+}
+
 typedef enum {
     OBSDalPluginNotInstalled,
     OBSDalPluginInstalled,

This is not enough of course, because we need to add also an user interface to call this uninstall_cmio_system_extension from somewhere, such as in the menu action.

Current Behavior

Users can't uninstall system extension once the app launched.

Steps to Reproduce
  1. Place OBS.app on /Applications
  2. Launch it, which will install an system extension to the system. Approve it in Settings app.
  3. Uninstall OBS.app, by dragging it to the trash.
  4. Restart macOS, if you want.
  5. Run systemextensionsctl list

Expected behavior
OBS virtual camera system extension should not be there, or provide a way to unstall it before step 3.

Actual behavior
OBS virtual camera system extension stay there and users have no way to remove it.

Anything else we should know?

Note that systemextensionsctl uninstall doesn't work on macOS without disabling SIP, which is highly not recommended to do so and that is not what regular users can do.

$ systemextensionsctl uninstall - com.obsproject.obs-studio.mac-camera-extension
At this time, this tool cannot be used if System Integrity Protection is enabled.
This limitation will be removed in the near future.
Please remember to re-enable System Integrity Protection!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in plugins/mac-virtualcam/src/obs-plugin/plugin-main.mm and inspect install_cmio_system_extension, the extension delegate, and existing menu or action entry points. Confirm how macOS deactivationRequestForExtension should be submitted, then add a user-accessible uninstall path and verify with the reproduction steps and systemextensionsctl list that the extension can be removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, objective-c
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.