Latest Method as of 20241016
Actually, just keeping a VPN running in the background is enough. If you’re concerned about data usage, configure rules to only allow specific websites to use the proxy, such as github.com.
The following method doesn’t work well anymore
Directly modifying the hosts file to invalidate network verification
This article is converted by SimpRead 简悦, original source www.shiqidu.com
The 2016 15-inch MacBook Pro was considered a high-end configuration at that time. Opening software was always slow. I always thought macOS was just like that, incomparable to Windows. Today, by chance, I searched online and saw an expert providing the following method, saying it could speed up software launch…
The 2016 15-inch MacBook Pro was considered a high-end configuration at that time. Opening software was always slow. I always thought macOS was just like that, incomparable to Windows. Today, by chance, I searched online and saw an expert providing the following method, saying it could speed up software launch, so I tried it. Unexpectedly, it really worked.
sudo vim /etc/hosts
Add a line to the hosts file
127.0.0.1 ocsp.apple.com
The expert explained that macOS validates the software signature with Apple’s server every time before opening software, which slows down the launch speed.
I can’t understand Apple’s operation, maybe it’s for system security? Whatever, I don’t need that functionality. Before modifying the hosts file, opening Edge and Firefox might cause the dock icon to bounce about 20 times; after the change, Firefox opens instantly, Edge bounces twice before opening (cold start is still slow).
Difference Between 127.0.0.1 and 0.0.0.0
Modifying the local hosts file to redirect the domain ocsp.apple.com to 127.0.0.1 and 0.0.0.0 results in different effects:
Redirecting the Domain to 127.0.0.1
- Effect: All requests to
ocsp.apple.comare redirected to the local machine’s loopback address. - Result: The local machine tries to handle these requests. If there is no service configured locally to respond to
ocsp.apple.comrequests, it usually returns a “connection refused” or “cannot connect” error.
Redirecting the Domain to 0.0.0.0
- Effect: All requests to
ocsp.apple.comare redirected to 0.0.0.0. - Result: Since 0.0.0.0 is an invalid target address, the operating system usually discards these requests immediately, possibly returning an error like “network unreachable,” but it does not attempt to send the request to any network interface.
Specific Differences
-
Handling Method:
- 127.0.0.1: The request arrives at the local machine and attempts to be processed by local services.
- 0.0.0.0: The request is usually discarded immediately without any further network attempts.
-
System Resource Consumption:
- 127.0.0.1: The system consumes some resources trying to process these requests, even if they are ultimately refused.
- 0.0.0.0: Requests are discarded immediately, consuming fewer system resources.
-
Error Messages:
- 127.0.0.1: You may see “connection refused” or “cannot connect” errors.
- 0.0.0.0: You may see “network unreachable” or similar errors.
Use Cases
- 127.0.0.1: Commonly used in development and debugging scenarios to test local server responses.
- 0.0.0.0: Commonly used to completely block access to a domain, making it unreachable.
In your case, if you want to fully block access to ocsp.apple.com, redirecting it to 0.0.0.0 is a better choice because it immediately discards requests and reduces system resource usage.