
mac 应用程序沙箱

Mac webcams include a light that turns on when your webcam is in use. With the right command, you can check which application is actually using your webcam.
Mac网络摄像头的指示灯在使用网络摄像头时会亮起。 使用正确的命令,您可以检查实际使用网络摄像头的应用程序。
Webcam spying is not some niche issue—-it’s very real. If you’re concerned about someone spying on you via your webcam, you may want to disable your webcam altogether to prevent any risk of spying. You can also install the Oversight app to get notifications whenever an app starts using your Mac’s webcam. But, if you’d rather just quickly check yourself—and avoid using third-party tools—you can use the tools built into your Mac.
网络摄像头监视不是一个小问题,它是真实的。 如果您担心有人通过网络摄像头对您进行监视,则可能希望完全禁用网络摄像头以防止进行任何监视的风险。 您还可以安装Oversight应用程序,以在应用程序开始使用Mac的网络摄像头时获取通知。 但是,如果您只是想快速检查一下自己-避免使用第三方工具,则可以使用Mac内置的工具。
You’ll need to launch a Terminal window to do this. To do this, open Spotlight search by pressing Command+Space, type “Terminal” into the box that appears, and press Enter. You could also open a Finder window and navigate to Applications > Utilities > Terminal.
您需要启动终端窗口来执行此操作。 为此,请按Command + Space打开Spotlight搜索,在出现的框中键入“ Terminal”,然后按Enter。 您也可以打开Finder窗口,然后导航至应用程序>实用程序>终端。

To find running processes using the webcam, type the following command in the terminal and press Enter. This line lists all open files and the processes associated with them, “pipes” that output to the grep command, and then the grep command searches for processes that have a file representing the webcam open.
要使用网络摄像头查找正在运行的进程,请在终端中键入以下命令,然后按Enter。 此行列出了所有打开的文件以及与之相关的进程,输出到grep命令的“ 管道 ”,然后grep命令搜索具有代表网络摄像头打开的文件的进程。
lsof | grep "AppleCamera"
You should see one or more results. If you don’t see any results, try running the following commands as well. One of the below commands may be necessary if you’re using an older version of macOS.
您应该看到一个或多个结果。 如果看不到任何结果,请尝试同时运行以下命令。 如果您使用的是旧版本的macOS,则可能需要以下命令之一。
lsof | grep "iSight"
lsof | grep "VDC"
The name of the process will appear at the left side of each line. In the line below, we can see the “Skype” process is using the webcam. If multiple applications are using the webcam, you may see multiple results.
进程的名称将显示在每行的左侧。 在下面的行中,我们可以看到“ Skype”进程正在使用网络摄像头。 如果多个应用程序正在使用网络摄像头,则可能会看到多个结果。
This command will only show you processes that are currently using the webcam. If a process was using the webcam a few seconds ago but wasn’t using the webcam when you ran the command, it won’t appear in the list.
此命令将仅向您显示当前正在使用网络摄像头的进程。 如果某个进程在几秒钟前正在使用网络摄像头,但在运行命令时未使用网络摄像头,则该进程不会出现在列表中。

To view more information about what exactly a process is, you can use the process ID displayed here. The process ID is the number displayed to the right of the process name. For example, in the screenshot above, the process ID is “1622”.
要查看有关什么是确切的进程的更多信息,您可以使用此处显示的进程ID。 进程ID是在进程名称右侧显示的数字。 例如,在上面的屏幕截图中,进程ID为“ 1622”。
Type the following command, replacing #### with the process ID, to view more information:
键入以下命令,将####替换为进程ID,以查看更多信息:
ps -p ####
In the example here, we ran ps -p 1622
. This showed more information about the process, including that it’s part of the Skype application at /Applications/Skype.app. If an application ever has a confusing process name, the ps command should point you to the application it’s a part of.
在此处的示例中,我们运行了ps -p 1622
。 这显示了有关该过程的更多信息,包括它在/Applications/Skype.app中是Skype应用程序的一部分。 如果应用程序的进程名称令人困惑,则ps命令应将您指向该应用程序的一部分。

If the command shows an application you don’t recognize, you may need to search the web to find what it is. If it’s a suspicious process, you can kill it by entering the following command and then providing your password when prompted:
如果该命令显示了您无法识别的应用程序,则可能需要搜索网络以查找其内容。 如果是可疑进程,则可以通过输入以下命令,然后在出现提示时提供密码来将其杀死:
sudo kill -9 ####
This command will always kill a process, even if the process doesn’t want to quit normally.
即使该进程不想正常退出,此命令也将始终终止该进程。
If you do have malicious software running on your Mac, you’ll want to remove the malware properly to get rid of it for good, rather than simply ending its process.
如果您确实在Mac上运行了恶意软件,则需要适当地删除该恶意软件以永久删除它,而不是简单地结束其过程。

翻译自: https://www.howtogeek.com/289352/how-to-tell-which-application-is-using-your-macs-webcam/
mac 应用程序沙箱