Problem description
"No route to host" error is thrown by IntelliJ IDE when trying to connect to a local IP address over SSH (including attempts to reach one of the SSH remote Linux boxes through JetBrains Gateway, Toolbox App, or In-IDE RD), or ping it from within the IDE Terminal window.
PING db.local (192.168.1.19): 56 data bytes
ping: sendto: No route to host
ping: sendto: No route to host
Common troubleshooting steps
You can try any number of steps below until one of them helps. If, for instance, restarting the server on step 3 helps, there is no need to perform steps 4 and 5.
- MacOS terminal ->
ping <hostname>/ping <IP address>If both commands fail, double-check that the server name/address is correct: no typos, etc. - MacOS terminal ->
nc -zv <IP/hostname> <port>(ortelnet <IP/hostname> <port>if you have telnet installed) If it fails, make sure the server is actually up. You can check it by, for example, runningnetstat -an | grep LISTEN | grep <port>on the server side. - MacOS terminal ->
traceroute <hostname>Check your DNS settings. For instance, if there is a VPN on your Mac, check if it is changing the gateway for the default route/0.0.0.0 to itself. If it does, you might need to change the settings to allow your LAN IP addresses to use the router gateway. - Switch to a different kind of Internet connection: e.g., cable instead of WiFi, and vice versa.
- Disable or uninstall network security software - e.g., ESET.
In some cases, macOS Local Network Privacy feature can block all IDE connections to local resources: databases, app servers, etc.
Solution 1
- Navigate to macOS System Settings | Privacy & Security | Local Network
- Toggle the setting ON for the IDE in question.
- If the setting is already on, toggle it OFF and then ON again.
- If you have other JetBrains IDEs installed, make sure ALL of them are granted the permission in the same fashion.
This solution should fix the issue for JetBrains Gateway (see also GTW-9769).
If you're using In-IDE RD, make sure JetBrains app is enabled as well (see "No route to Host" for local connections via Daemon).
Solution 2
If the issue persists, check this blog post for another workaround: tweaking firewall settings from the system terminal using the socketfilterfw CLI tool.
Example for IntelliJ IDEA and WebStorm:
/usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/IntelliJ\ IDEA.app
/usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/WebStorm.app
If the IDEs were installed via the Toolbox app, please see this comment for the details how to find the installation path.
NOTE: make sure to escape spaces with backslashes (\).
Solution 3
If your IDE is installed via Toolbox, try running it not from Toolbox or the icon in your dock / start menu, but from the terminal / command line.
For more information, see:
- https://www.jetbrains.com/help/idea/working-with-the-ide-features-from-command-line.html
- https://www.jetbrains.com/help/idea/opening-files-from-command-line.html
Solution 4
See if it helps to install the IDE using a different method. If you installed using the standalone installer (.dmg/.exe), try to uninstall and install via https://www.jetbrains.com/toolbox-app/ and vice versa.
Solution 5 for JetBrains Gateway
- Navigate to macOS System Settings | Privacy & Security | Local Network
- Make sure ALL JetBrains IDEs are given permissions
If nothing helps and the issue still persists
Some people reported that none of the above helped in their case. As a last resort, you can try to:
- Reset macOS network settings: In Finder use Go at the top bar, then Go to Folder and enter this:
/Library/Preferences/SystemConfiguration. Back up and delete the following files:com.apple.airport.preferences.plist,NetworkInterfaces.plist,preferences.plist. Reboot the device. - Contact Apple Support for further guidance
Comments
0 comments
Please sign in to leave a comment.