DEV Community

Cover image for Use one Python terminal command to start a quick local HTTP server on your OS X machine 💻
Richard
Richard

Posted on

Use one Python terminal command to start a quick local HTTP server on your OS X machine 💻

I found myself wanting to dump some PDFs on my Kobo Forma ebook reader. But I didn't feel like digging out my USB-C to USB-A adapter so I could plug in the cable and use Calibre to transfer the books.

Hmm... well, the reader does have a rudimentary browser... I wonder if I could just download the books via HTTP or FTP on my wireless LAN?

So I found a way to do it.

First, fire up terminal and navigate to the directory that contains the files you want to serve.

Then run python -m SimpleHTTPServer 8000 and Bob's your Uncle.

terminal screenshot 1

(I found sudo apachectl start as well, which runs an apache server, but I like the python thing better.)

P.S. You can CMD-N to open a second terminal window, then use the command ifconfig en0 inet to get the IP of your server.

terminal screenshot 2

Top comments (0)