cloudflared: `cloudflared service install` broken on macOS
Steps to reproduce
sudo cloudflared service installtail -f /Library/Logs/com.cloudflare.cloudflared.err.log /Library/Logs/com.cloudflare.cloudflared.out.log- Observe repeating line in error log
Use `cloudflared tunnel run` to start tunnel MY_TUNNEL
Expected result:
Seeing the usual tunnel startup info in the logs
A fix that worked for me
Edit /Library/LaunchDaemons/com.cloudflare.cloudflared.plist
Original (runs /usr/local/bin/cloudflared)
<array>
<string>/usr/local/bin/cloudflared</string>
</array>
Fixed (runs /usr/local/bin/cloudflared tunnel run)
<array>
<string>/usr/local/bin/cloudflared</string>
<string>tunnel</string>
<string>run</string>
</array>
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 8
- Comments: 17 (2 by maintainers)
Additional instructions for
.plistediting:sudo cloudflared service install(you MUST usesudo, as the intention here is to runcloudflaredat boot per the docs).plistfilesudo launchctl stop com.cloudflare.cloudflaredsudo launchctl unload /Library/LaunchDaemons/com.cloudflare.cloudflared.plistsudo launchctl load /Library/LaunchDaemons/com.cloudflare.cloudflared.plistlaunchctl load, but you can alsosudo launchctl start com.cloudflare.cloudflaredTo troubleshoot
launchctl:launchctl dumpstate > myfile.txtthen open file and search for stringcloudflared– this is how I realized only the commandcloudflaredwas executing and notcloudflared tunnel run.It was frustrating to be told by Cloudflare Support that the product team did not consider this something requiring action to resolve. I also see the same intention in this PR response.
My last message to Cloudflare Support:
I absolutely love the Argo Tunnel product, and use it in production on multiple projects. However the learning curve was extremely steep and full of trial-and-error, due to sharp edges such as this issue (#327). That learning curve is the reason I have not extended my use of Argo Tunnel and cloudflared to other teams in my organization.
Thank you!
I did a bit more to have it working as service/daemon on macOS, with help of @adamfeldman findings:
cloudflared.plist.patch:cloudflared version 2023.5.1 (built 2023-05-23-1847 UTC)
note: This is still an issue when you install as a service and required
~/.cloudflared/*to/etc/cloudflared/*<< not sure this step is even doing anything, as suggested in the documentation. WEIRD.Otherwise my log.err was full of
Until editing .plist manually according to the comment above. I edited the plist using sudo vi by hand.
This is going to be fixed in the next release
As for this whole thread/issue, we’ll have it fixed in the scope of a big new feature. Stay tuned.
Thanks for your help @adamfeldman - a big help on something that I’d have expected Cloudflare to catch.
Also note (for other struggling with this) that the value of the first
<string>item might be/opt/homebrew/bin/cloudflaredif HomeBrew was used for the installation of Cloudflared as suggested in the official docs