houdq / blog

java 学习笔记
0 stars 0 forks source link

macos Catalina 10.15 微信截图权限 #124

Open houdq opened 3 months ago

houdq commented 3 months ago

最近系统降级,装了微信后发现截图要权限。 而且macos10.15 后没有+,怎么搞? 程序员眼里没有不可能, Google 了一番可以自己 tccutil 搞一波。

sudo /usr/bin/sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db "INSERT or REPLACE INTO access VALUES('kTCCServiceScreenCapture','com.tencent.xinWeChat',0,1,1,NULL,NULL,NULL,'UNUSED',NULL,0, strftime('%s','now'));"
houdq commented 3 months ago

参考1 https://www.rainforestqa.com/blog/macos-tcc-db-deep-dive#TCC_for_the_User

houdq commented 3 months ago

参考2 https://zhuanlan.zhihu.com/p/436926519

houdq commented 3 months ago

参考 3 https://www.cnblogs.com/Flat-White/p/16448648.html

houdq commented 3 months ago

via ChatGPT

To add screen recording permission for WeChat on macOS, you can use the sqlite3 command to modify the TCC (Transparency, Consent, and Control) database. Here's how to grant screen recording permission to WeChat:

  1. Open Terminal.
  2. Run the following command (with elevated privileges using sudo):
sudo /usr/bin/sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db "INSERT or REPLACE INTO access VALUES('kTCCServiceScreenCapture','com.tencent.xinWeChat',0,1,1,NULL,NULL,NULL,'UNUSED',NULL,0, strftime('%s','now'));"

Explanation of the SQL command:

After running this command, you may need to restart your Mac or log out and log back in for the changes to take effect.

Note: Modifying the TCC database directly can have unintended consequences, and it's generally recommended to use the system preferences UI to manage permissions when possible.