macOSでデバイスドライバを手動削除する方法

macOSデバイスドライバ(機能拡張)を手動で削除する方法です

SIP(System Integrity Protection )というシステム保護機能を一旦無効にして作業する必要があるため,少々煩雑な手順になります

手順1 リカバリーモードに入る

再起動して,リカバリーモードに入ります.
古いmac(cpuがintel製)と,新しいmac(M1やM2)で手順が異なります.

古いmac(cpuがintel製)

  1. システムをシャットダウンして一度電源が切れた状態にします
  2. 「Command」キーと「R」キーを同時押して,電源を入れます

新しいmac(M1やM2)

  1. システムをシャットダウンして一度電源が切れた状態にします
  2. touch ID(電源ボタン)を30秒ぐらい長押し続けます

手順2 リカバリーモードに入る

リカバリーモードを選択,管理者権限のアカウントでログインします

手順3 SIPを無効にする

1. 画面上部のメニューからターミナルを起動します
2. ターミナル上で以下のコマンドを実行します

csrutil disable

3. 確認のメッセージが表示されるので y を入力

Turning off System Integrity Protection requires modifying system security.
Allow booting unsigned operating systems and any kernel extensions for
 [y/n]:

4. 以下のメッセージが表示されれば成功です

System Integrity Protection is off.
Restart the machine for the changes to take effect

5. 再起動します

reboot

手順4 通常モードでログイン

再起動します.

SIPが無効状態になっているか確認します

csrutil status

SIPが有効の場合は以下の表示になります
System Integrity Protection status: enabled.

SIPが無効の場合は以下の表示になります
System Integrity Protection status: disabled.


以下の作業はSIPが無効状態,つまり
System Integrity Protection status: disabled.
である必要があります

手順5 デバイスドライバ(機能拡張)のインストール状況確認

sudo systemextensionsctl list

ドライバの名称,teamID,bundleID の一覧が表示されます

手順6 デバイスドライバ(機能拡張)の手動アンインストール

sudo systemextensionsctl uninstall  <teamID> <bundleID>

teamIDとbundleIDは,削除したいデバイスドライバのteamIDとbundleIDそれぞれ指定します

手順7 キャッシュの更新

念の為,手動でドライバのキャッシュを再作成します

sudo kextcache -i /

手順8 不要ファイルの手動削除

/Library/Extensions/ 以下にファイルがあれば手動削除します

手順9 再起動&動作確認

再起動して,デバイスドライバが消えたかどうか確認します

手順10 SIP再有効化

再びリカバリーモードに入り,SIPを有効に戻しておきます

csrutil enable

CUDAを glibc 2.41で動かすためのパッチ

glibc 2.41(Ubuntu 25.04 や debian sid で採用)で cuda toolkit を使うにはパッチが必要です

と言っても,以下のパッチを /usr/local/cuda/include/crt/math_functions.h に当てるだけで解決です

  1. --- math_functions.h.orig~ 2025-05-22 11:09:49.994627842 +0900
  2. +++ math_functions.h 2025-05-22 11:11:05.624851346 +0900
  3. @@ -2553,7 +2553,7 @@
  4. *
  5. * \note_accuracy_double
  6. */
  7. -extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi(double x);
  8. +extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi(double x) noexcept (true);
  9. /**
  10. * \ingroup CUDA_MATH_SINGLE
  11. * \brief Calculate the sine of the input argument
  12. @@ -2576,7 +2576,7 @@
  13. *
  14. * \note_accuracy_single
  15. */
  16. -extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float sinpif(float x);
  17. +extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float sinpif(float x) noexcept (true);
  18. /**
  19. * \ingroup CUDA_MATH_DOUBLE
  20. * \brief Calculate the cosine of the input argument
  21. @@ -2598,7 +2598,7 @@
  22. *
  23. * \note_accuracy_double
  24. */
  25. -extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double cospi(double x);
  26. +extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double cospi(double x) noexcept (true);
  27. /**
  28. * \ingroup CUDA_MATH_SINGLE
  29. * \brief Calculate the cosine of the input argument
  30. @@ -2620,7 +2620,7 @@
  31. *
  32. * \note_accuracy_single
  33. */
  34. -extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float cospif(float x);
  35. +extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float cospif(float x) noexcept (true);
  36. /**
  37. * \ingroup CUDA_MATH_DOUBLE
  38. * \brief Calculate the sine and cosine of the first input argument


経緯としては

  1. 2025年1月 glibc 2.41 登場
  2. cuda toolkit で不具合発生
    • forums.developer.nvidia.com
    • 今までのglibc は sinpi(double x) だったのに,glibc 2.41 で sinpi(double x) noexcept (true) に変更された
    • cuda側でも同じ変更が必要になった
  3. 2025年5月現在.まだ修正されず

という感じです

2025年5月時点で未だに修正されてないので,ブログに書いておくことにしました