28

Is there a super lightweight file server that I could use for development on my mac?

I'm imagining something like:

> cd somefolder
> run server
  ...running static file server at http://0.0.0.0:2343...

It's only for development of static html/css/js/images - no outside connections needed.

bendytree
  • 13,095
  • 11
  • 75
  • 91

2 Answers2

72

Sure! And it's already installed.

Just try this:

cd path/to/files
python3 -m http.server

If you want to run it on a specific port instead of 8000 (the default), just append the port number as a second argument, like:

python3 -m http.server 2343
clee
  • 10,943
  • 6
  • 36
  • 28
0

It is also possible using php (e.g. listening on localhost and port 8080):

php -S localhost:8080

Or see this question doing it with netcat/nc/bash.

Pierz
  • 7,064
  • 52
  • 59