Knowledge Base

Arduino IDE can't connect to the internet on macOS

Question

Arduino IDE on macOS cannot access the internet (Board Manager, Library Manager), while terminal tools like curl or brew work. Proxy settings in the IDE appear ineffective. How can this be fixed?

Answer

Run a local forward HTTP proxy and point Arduino IDE to it.

Install and run:

brew install tinyproxy

# Backup config
cp /opt/homebrew/etc/tinyproxy/tinyproxy.conf /opt/homebrew/etc/tinyproxy/tinyproxy.conf.bak

# Make it listen only on localhost:8080 and allow localhost clients
perl -0777 -i -pe '
s/^\s*#?\s*Port\s+\d+/Port 8080/m;
s/^\s*#?\s*Listen\s+.+/Listen 127.0.0.1/m;
s/^\s*#?\s*Allow\s+.+/Allow 127.0.0.1/mg;
' /opt/homebrew/etc/tinyproxy/tinyproxy.conf

# Run in foreground (easy to stop with Ctrl+C)
tinyproxy -d -c /opt/homebrew/etc/tinyproxy/tinyproxy.conf
brew install tinyproxy

# Backup config
cp /opt/homebrew/etc/tinyproxy/tinyproxy.conf /opt/homebrew/etc/tinyproxy/tinyproxy.conf.bak

# Make it listen only on localhost:8080 and allow localhost clients
perl -0777 -i -pe '
s/^\s*#?\s*Port\s+\d+/Port 8080/m;
s/^\s*#?\s*Listen\s+.+/Listen 127.0.0.1/m;
s/^\s*#?\s*Allow\s+.+/Allow 127.0.0.1/mg;
' /opt/homebrew/etc/tinyproxy/tinyproxy.conf

# Run in foreground (easy to stop with Ctrl+C)
tinyproxy -d -c /opt/homebrew/etc/tinyproxy/tinyproxy.conf

Then configure Arduino IDE:

...
network:
  proxy: http://127.0.0.1:8080/
  connection_timeout: 300s
  download_timeout: 1800s
...
network:
  proxy: http://127.0.0.1:8080/
  connection_timeout: 300s
  download_timeout: 1800s

The timeouts will get rid of DEADLINE_EXCEEDED errors.

Explanation

On certain networks, HTTPS traffic is intercepted or handled in a way that some applications do not cope with correctly, even though system tools do. A local forward proxy such as tinyproxy tunnels HTTPS using CONNECT without TLS interception or custom certificates, acting as a compatibility layer for the Arduino IDE.

Vart är hoppstrumporna?

Det heter var, inte vart, och de är längst in i din strumplåda.