Skip to content

Instantly share code, notes, and snippets.

@crcdng
Last active August 31, 2021 06:52
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crcdng/b063987dfb62baf5d0afda422631b480 to your computer and use it in GitHub Desktop.
Save crcdng/b063987dfb62baf5d0afda422631b480 to your computer and use it in GitHub Desktop.
How to fix Processing on MacOSX 15 Catalina

How to fix Processing (https://processing.org) Camera and Microphone on macOS 10.15 Catalina

This solution requires that you are a member of the Apple Developer program

Last updated on 2020_11_08

Update: In Processing alpha2 (15 September 2020) with the libraries Sound 2.2.3 and Video 2.0, Audio and Video input are still broken. The workaround below should work with that version as well, although I have not tested it.

Apple has been changing around things for developers quite a lot since 2019. This concerns (among others):

  • newly required permissions for apps that access the camera and microphone
  • the removal of 32 bit applications
  • the "notarization" mechanism
  • access to (un-)signed apps

Since the development of Processing has slowed down significantly, audio (microphone) and video (camera) are broken in versions 3.5.4 as well as in 4.0 alpha 1 (both released in January 2020).

Here is a workaround that hopefully will be obsolete soon.

1. Install Processing

If you haven't, install Processing 3.5.4 from https://processing.org/download/

2. Install the Sound Library

Start it and install the P5 Sound Library with Sketch -> Import Library -> Sound

3. Exit Processing

4. Add the P5 Video Library manually from Github

Go to https://github.com/processing/processing-video/releases/tag/r6-v2.0-beta4 Download the file video-2.0-beta4.zip, unzip and put the video folder into the libraries folder in your sketch folder. Make a note of this folder.

Result: You now have these libraries installed: Video 2.0-beta4 and Audio 2.2.3 (at the time of me writing this; later versions may work as well)

5. Add Permissions

Edit both /Applications/Processing.app/Contents/Info.plist and /Applications/Processing.app/Contents/PlugIns/jdk1.8.0_202.jdk/Contents/Info.plist

and add the keys

<key>NSCameraUsageDescription</key>
<string>Processing needs access to the camera for creative coding</string>

<key>NSMicrophoneUsageDescription</key>
<string>Processing needs access to the microphone for creative coding</string>

You have to go into the Processing App bundle to do this. If you open the plist files with XCode, you can add the keys from the dropdown list. Both have the "Privacy ..." prefix.

6. Re-Sign Processing

In a Terminal enter:

codesign --remove-signature /Applications/Processing.app                    

codesign -s "<YOUR IDENTITY>" -v /Applications/Processing.app

This is the step which requires you to be a registered Apple developer: replace <YOUR IDENTITY> with one of your Apple developer identities. You find these in Keychain Access. I am using my Apple Development certificate which is valid for 6 months by which time the Processing developers have hopefully spent 10 minutes to fix this.

Result: Now audio (microphone access) will work. To confirm this, restart Processing and run Examples > Libraries > Sound > IO > AudioInput You will get a pop up asking you to give Processing access to your microphone. Confirm. Later you can switch this on/off in your Mac's System Preferences > Security & Privacy > Privacy > Microphone setting.

7. Unlock the Video library

In a terminal, go to the folder where you copied the video in step 4 and change access settings:

cd /Users/<YOUR USERNAME>/Documents/Processing/libraries/video

xattr -r -d com.apple.quarantine * 

Note that this step circumvents Apple's mechanisms that Apple thinks should protect you. To do this you should trust the developers of the Processing video library and the security of Github. Proceed on you own risk. No warranties given (see license below).

Result: Now video (camera access) will work. To confirm this, restart Processing and run Examples > Contributed Libraries > Video > Getting started Capture

You will get a pop up asking you to give Processing access to your camera. Confirm. Later you can switch this on/off in your Mac's System Preferences > Security & Privacy > Privacy > Camera setting.

Note: you might need to edit older code including some of the examples thhat come with the Video library. If you see something like this in your setup() function,

  video = new Capture(this, 640, 480);

replace it with something like this:

  String[] cameras = Capture.list();
  video = new Capture(this, 640, 480, cameras[0]);

8. Done

Hopefully new version of Processing and its libraries are released that makes this obsolete.

Note: I still get lots of crashes (errors) in the processing console, many not related to audio/video such as GL errors. Thus Processing still ist not working ok, but at least the sketch runs.

Note: As mentioned above, you must be a member of the Apple Developer program in order for this to work. When I was researching the issue, a lot of people already had contributed suggestions online - thank you. So other approaches might work as well including ones where you can avoid step 6 for which you have to be enrolled in the Apple Developer program.

Good starting points are: processing/processing-sound#51 and processing/processing-video#134

This work is licensed under a Creative Commons Attribution 4.0 International License. https://creativecommons.org/licenses/by/4.0/

@pnerum
Copy link

pnerum commented Jun 15, 2020

It’s really not hard for the developers to fix this issue....

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