Change default port (at least on macOS)
macOS now uses port 5000 by default for AirPlay discovery (https://news.ycombinator.com/item?id=29006861). Attempting to start Fava with the default port now fails silently on macOS (it says it's running, but the web interface doesn't load because the port is already in use by the system).
Port 5000 is in any case already a reserved port for UPnP:
- https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?&page=88
- https://www.grc.com/port_5000.htm
It would be better to use a port in the 8000+ range (and also to detect if the port is already in use and fall back to a higher port).
Thanks for the report :)
This port was chosen simply by being the default port that the Flask dev server binds on. I think I'll stick with that default like Flask (https://github.com/pallets/flask/issues/4328), but Fava should definitely error out if the port is already in use. It seems that it currently doesn't due to cheroot binding to ip6 localhost (so [::1]:5000) if ip4 localhost is in use (which I find to be surprising behaviour). I'll fix that.
Encountered this issue today. Seems like the error handling in #1378 may not be working.
A PR with a fix would be welcome then :)
You can just add an alias in the ~/.zshrc file to set the port to a different one. I don't have issues with it on MacOS.
alias startfava="fava main.beancount -p 5001"
You can then just type startfava in your Terminal. Edit the port and file to your needs