Skip to content

Instantly share code, notes, and snippets.

@fcoclavero
Created December 28, 2020 21:55
Show Gist options
  • Save fcoclavero/431123c7708e42de63eb75264a44de02 to your computer and use it in GitHub Desktop.
Save fcoclavero/431123c7708e42de63eb75264a44de02 to your computer and use it in GitHub Desktop.
Fix Razer device not detected on macOS Big Sur 11.1

@Jandalf I recently had to reset my System Integrity Protection settings (csrutil clear) and once again ran into this issue, where my Razer device was not recognized.

I have upgraded to macOS Big Sur 11.1, and I can confirm that the solutions by @avaddon and @rdabban, which had worked for me on 11.0, no longer work.

Manually loading the kernel extension (the kextload command) will display the error code 27 "Extension with identifiers com.razer.common.razerhid not approved to load. Please approve using System Preferences.", but no pop-up or "Allow" option would appear anywhere on the System Preferences.

Adding the Razer TeamID with the /usr/sbin/spctl kext-consent add R2H967U7J8 command showed me a pop-up, but with no "Allow" option, and no option to allow the kernel extension would appear in the System Preferences, so no good.

I finally managed to make it work by temporarily disabling System Integrity Protection (SIP), as follows:

  1. Boot into Recovery Mode. This can be done by restarting your computer and holding Cmd+R on boot until a loading bar shows up.
  2. Once in Recovery Mode, sign in with your account and open a terminal. You can find it in the top menu under Utilities > Terminal.
  3. Disable SIP by running the following command: csrutil disable.
  4. Close the terminal and reboot (normal reboot, not into Recovery Mode).
  5. Open a terminal and load the extension with the following command: sudo kextload /Library/Extensions/RazerHid.kext.
  6. Reboot (normal reboot, not into Recovery Mode) and confirm that your Razer device is now correctly detected.
  7. Now we must reenable SIP to maintain system security. This should not break your device. Boot once more into Recovery Mode, open a terminal, run csrutil enable, close the terminal and reboot.

You should now be able to load your Razer device AND have SIP enabled.

Good luck y'all!

@TheOneTheyCall-Tim
Copy link

What @CodeBlazer posted above was the combination of permissions that worked (best) for me.

So that would be:

My settings for the System Preferences/Security & Privacy/Privacy tab I checked the boxes for:

  • Accessibility -> RzDeviceEngine
  • Input Monitoring -> RzUpdater, RzDeviceEngine
  • Full Disk Access -> RzUpdater, RzDeviceEngine

That got Synapse recognizing my Naga, and all of my thumb buttons that are bound to single keys (F8, Del) work, bound to changing keymaps work. However, thumb keys that are bound to macros (might spell a word, or at least a multiple letter command, or activate some menu items via keystrokes) still do NOT work.
I tried a couple other combinations based on that to see if I can get the macros back in gear. I did not succeed.

I'm looking at Karabiner right now to see if it will do what I need. It's going to be a slightly different approach. I haven't figured out how to change a single key into multiple keystrokes yet, unless you just provide multiple "to:" items for each "from:". That's my current theory. I haven't had a chance to test it yet. Karabiner is not for the faint of heart. If you try Karabiner, I hope you have a programming background. It's not particularly difficult programming skills you need to control the mouse with it, but it's going to look awful weird to anyone who's never programmed before.

As I understand it, Karabiner does not have any control over the lighting. I don't particularly care about that, though it is useful as a visual reference to what mode/keymap the mouse is in.

Also, people have posted about the mouse showing up on Karabiner as both a mouse and a keyboard. When the mouse is enabled, there is a nasty lag that shows up from time to time. I have seen that as well. However, since the main thing I'm looking to do is control the thumb buttons, this can be done by enabling the mouse keyboard part but not the mouse mouse part, if that makes any sense.

This would be so much easier if synapse would just work. It's close. It was working last week. Aside from its usual foibles anyway.

@pmb123
Copy link

pmb123 commented Sep 11, 2022

Alright, I managed to get it to work (with SIP enabled) on MacOS Big Sur. Basically I combined two solutions mentioned before. Namely:

The steps in this link: https://gist.github.com/fcoclavero/431123c7708e42de63eb75264a44de02

And the solution provided by @Avaddon in this thread: https://developer.apple.com/forums/thread/649829

So first of all, thanks to @Avaddon and @fcoclavero

I tried the solutions in the order I mentioned them, but combined, it will be:

  • Boot into Recovery Mode: hold Cmd+R while starting up
  • Click the Utilities menu and select Terminal.
  • Disable SIP (System Integrity Protection) by running: csrutil disable
  • Execute the following command:
    /usr/sbin/spctl kext-consent add R2H967U7J8
  • Verify that team got added:
    /usr/sbin/spctl kext-consent list

Should output something like: Allowed Team Identifiers: R2H967U7J8

  • Close the Terminal app and restart (normal reboot, not into Recovery Mode)
  • Open a terminal and load the extension with the following command (reboot (normally) when asked):
    sudo kextload /Library/Extensions/RazerHid.kext

This should give a popup which tells to press the allow button in System Preferences The button should be located at the bottom of the General tab in Security & Privacy Something with SIP (System Integrity Protection) might be the reason why the allow button doesn't show up (that's why we disabled SIP in Recovery Mode)

My settings for the System Preferences/Security & Privacy/Privacy tab I checked the boxes for:

  • Accessibility -> RzDeviceEngine
  • Input Monitoring -> RzUpdater, RzDeviceEngine
  • Full Disk Access -> RzUpdater, RzDeviceEngine
  • See if it works:
    Start Razer Synapse, probably it won't show the device
    disconnect, connect the device and it should appear

If this works, Re-enable SIP to maintain system security:

  • Boot again in Recovery mode (Command + R).
  • Open the terminal and run: csrutil enable
  • Close the terminal and reboot

For me it works, with SIP enabled, the only problem is that I have to reconnect the device each time I start my computer and open Razer Synapse. Razer Synapse will say "Please connect a Razer Synapse enabled device" until I reconnect it. I wrote a little Python3 script which will do this (to save my usb cables).

#!/usr/bin/env python3
import usb.core
import usb.util

#find our device
dev = usb.core.find(find_all=True)

for device in dev:
	product_name = usb.util.get_string(device, device.iProduct)
	if "device_name" in product_name:
		print(product_name)
		device.reset()
		break

This script can then be called with a shell script:

#!/bin/bash

python3 /path/to/PythonScript.py

Which is clickable if saved with the extension: .command

Hopefully this will help!

Mostly working in Monterey with the exception of RzDeviceEngine not showing up under full disk access... any ideas? and like @PensoGlide I too had to reinstall to get the recovery mode shell commands to register.

@huug69
Copy link

huug69 commented Oct 4, 2022

Big Sur 11.7

I can activate RazerHid.kext as described above, but the python script to reconnect the device does not work on restart.

I get the following error in Terminal:

if "Razer" in product_name:
TypeError: argument of type 'NoneType' is not iterable

The script does work however if I disconnect and reconnect my usb Razer mouse and try again.

I checked the following:

  • RzDeviceEngine not showing up under full disk access
  • The Razer mouse is visible in Hackintool / USB but is not detected by the python script after restart

EDIT:

  • I managed to drop RzDeviceEngine from the finder into system prefs/Privacy/Full disk acces: no succes further
  • Also tried to include the sudo kextload with password from above Into the python script, didn't work either

EDIT 2:

Checking USB ports behavior with the terminal uhubctl (install explained a few posts above):
My Razer mouse is found when attached to the Apple USB wired keyboard or a USB 2.0 HUB . In this case, the everything works including the pythonscript.

Thanks everyone above

@huug69
Copy link

huug69 commented Oct 4, 2022

#!/bin/bash

python3 /Users/huug/Pythonmap/RAZER_USB_FIX/RazerUsbFix.py
sleep 15
open -a /Applications/Razer\ Synapse.app

had to add open Razer_synapse.app command to wake the thing up

@huug69
Copy link

huug69 commented Jan 7, 2023

Still working after updating from Big Sur to Monterey 12.6.2

@huug69
Copy link

huug69 commented Feb 8, 2023

spctl kext-consent stores its values in NVRAM.

If you reset your NVRAM you will need to restore the kext-consent.

@viniciusmi00
Copy link

viniciusmi00 commented Apr 5, 2023

I preferred to create an Application in Automator, and put it to start with the login. I thought better. Just use "Utility > Run Shell Script" in Automator.
Put shell > /usr/local/bin/python3

# It is necessary install libusb on mac. "brew install libusb".
# Maybe need to install PyUSB. "python3 -m pip install pyusb".

import usb.core
import usb.util

VID = 0x1532 # VendorID of the device you want. In my case Razer Mamba.
PID = 0x0024 # ProductID of the device you want. In my case Razer Mamba.

dev = usb.core.find(idVendor=VID, idProduct=PID)
dev.reset()
exit(0)

You just need to remember to put your device's VendorID and ProductID so that it only reset.
Work in Ventura 13.3

@nwasmb
Copy link

nwasmb commented Nov 19, 2023

Hi Gents,

Frustrated to not be able to use my Razer Naga Trinity properly, I've been following a few leads online but without succeeding :(

I'm on Macbook pro Apple M1, Ventura 13.5.1 (22G90). Synapse 1.88.20

I've first tried the method by u/sidneytsilva
https://www.reddit.com/r/razer/comments/y82wwx/mac_users_getting_please_connect_a_razer_synapse/

then avaddon method
https://developer.apple.com/forums/thread/649829

Finally came to this thread, and tried CodeBlazer method. Unfortunally, when reaching to this step Open a terminal and load the extension with the following command (reboot (normally) when asked):
sudo kextload /Library/Extensions/RazerHid.kext
This should give a popup which tells to press the allow button in System Preferences
, I get "System extension blocked - System extension blocked a program tried to load new system extension(s) signed by "Razer USA Ltd." that need to be updated by the developer"

I did Disable SIP on R-mode and add R2H967U7J8. When I try to run sudo kextload /Library/Extensions/RazerHid.kext, I get the following:
Executing: /usr/bin/kmutil load -p /Library/Extensions/RazerHid.kext
Error Domain=KMErrorDomain Code=71 "Incompatible architecture: Binary is for x86_64, but needed arch arm64e
Unsupported Error: one or more extensions are unsupported to load Kext com.razer.common.razerhid v21.94 in executable kext bundle com.razer.common.razerhid at /Library/Extensions/RazerHid.kext
Unsupported Error: one or more extensions are unsupported to load Kext com.razer.common.razerhid v21.94 in executable kext bundle com.razer.common.razerhid at /Library/Extensions/RazerHid.kext" UserInfo={NSLocalizedDescription=Incompatible architecture: Binary is for x86_64, but needed arch arm64e
Unsupported Error: one or more extensions are unsupported to load Kext com.razer.common.razerhid v21.94 in executable kext bundle com.razer.common.razerhid at /Library/Extensions/RazerHid.kext
Unsupported Error: one or more extensions are unsupported to load Kext com.razer.common.razerhid v21.94 in executable kext bundle com.razer.common.razerhid at /Library/Extensions/RazerHid.kext}

Am I doing somethiong wrong? I'm completely neophyte when it comes to mac, usually a pc user. For what I can read from the error message it could be a compatibility issue? If someone is able to point me toward the right direction it'd be really grateful!

@huug69
Copy link

huug69 commented Nov 19, 2023

I'm using Steermouse now, running flawless since a few months, with all keys programmable and multiple profiles for al your apps. website is https://plentycom.jp/en/steermouse/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment