One Line Web Server

Start a Web Server With One Terminal Command on OS X | CSS-Tricks

I’ve searched for this three times this week, so I figured I’d better make sure I have a copy of it. Python 2: python -m SimpleHTTPServer 8000 Navigate to the project directory in the terminal and do that command. Then http://localhost:8000 will server up that directory (as in, it’s `index.html` file).

  • Python2: python -m SimpleHTTPServer 8000
  • Python3: python3 -m http.server --cgi 8080
  • Php: php -S localhost:2222
  • Npm: npm i -g serve // serve


brew install node (if you have brew installed)

npm install -g npm@latest
npm i -g n && n latest
(Node package manager)

(nvm install node –reinstall-packages-from=node)

brew update && brew upgrade node && npm install -g npm

  1. sudo npm cache clean -f ———— (force) clear you npm cache
  2. sudo npm install -g n ———install n (this might take a while)
  3. sudo n stable ——— upgrade to lastest version
    node -v

You could install nvm and have multiple versions of Node.js installed.
curl | sh
source ~/.nvm/
and then run:
nvm install 0.8.22 #(or whatever version of Node.js you want)
you can see what versions you have installed with :
nvm list
and you can change between versions with:
nvm use 0.8.22
The great thing about using NVM is that you can test different versions alongside one another. If different apps require different versions of Node.js, you can run them both.