Test jekyll site on iPhone - really solved

how do folks here preview their jekyll site on an iPhone connected to the same wifi? From macos using jekyll serve (localhost:4000) - I can get it to show on the simulator but which ip do I need to enter in the real phone? I seem to remember this is possible without setting up webpack or browserify etc. Thank you for any pointers.

I forgot all about apache and vhosts. So I settled for the clunky solution where the _sites folder contents get rsynced locally to a vhost document root and that shows on the iPhone at 192.168.x.x/jekyllsite.local

You can use

ip -a

To find your machine’s ip on the network

Port 4000 might be blocked with firewall but Apache and port 80 could work as you seem to have done.

Also check out ngrok
It will give you a temporary random URL for a given localhost port number which you can enter in your phone or even send to anyone on the internet. No firewall fiddling needed
Ideal for viewing on a phone

You can also try use Netlify as it builds a preview URL on a feature branch so you can test your site from anywhere on any device without merging to master

1 Like

By default jekyll serve doesn’t expose the site on the local network (for security reasons), but you can open it to the local network using the -H or --host flag. Use to bind to the host’s local IP address:

bundle exec jekyll serve --host

Now you can visit the site from any machine on the local network at: http://192.168.x.x:4000/

If you’re developing on a Mac, then you can take advantage of Bonjour/ZeroConf and use the Mac’s name rather then the ever-changing local IP address. The Mac’s name is defined in System-Preferences > Sharing > Computer-Name.

For example, if you’ve named your Mac “Eddy”, then you can access your Jekyll site at http://Eddy.local:4000/


perfect - thank you so much. works as advertised.