Start an FTP (or TFTP or SFTP) server on Mac OS X (10.7+)

FTP

Since upgrading to Lion (10.7) the option to enable the FTP server has disappeared for, I assume, security reasons.

Nonetheless, an FTP server is still available to the user. Let’s see how it can be started from a CLI one-liner:

$ sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist

You can immediately confirm that by trying:

$ ftp localhost

NOTE: files will be served from the user’s home directory.

To stop the FTP server just issue:

$ sudo -s launchctl unload -w /System/Library/LaunchDaemons/ftp.plist

TFTP

To start/stop a TFTP server replace ftp.plist with tftp.plist.
The source directory in this case will be /private/tftpboot.
NOTE: the files must be readable.

SFTP

As fas as SFTP (S=secure) goes instead, this can be enabled through System Preferences’ Sharing application. It’s not explicitly mentioned but if Remote Login (SSH) is on then the computer’s IP address will also respond to SFTP/SCP requests.

For the tech-savvy, yes, this is better referenced to as FTP over SSH.

Source: http://osxdaily.com/2011/09/29/start-an-ftp-or-sftp-server-in-mac-os-x-lion/

Instant Python HTTP server

The quick and dirty way of starting an instant web server is by means of Python‘s simple HTTP request handler.

The following command will start listening to HTTP requests on port <port> (if <port> is blank a default value of 8000 is assumed) and will be serving files from the current directory:

$ python -m SimpleHTTPServer <port>

On the host’s console the access log will be displayed (example):

Serving HTTP on 0.0.0.0 port 4444 ...
<source address> - - [16/May/2013 12:12:17] "GET / HTTP/1.1" 200 -
<source address> - - [16/May/2013 12:12:17] "GET /favicon.ico HTTP/1.1" 404 -
<source address> - - [16/May/2013 12:12:19] "GET /example_file.txt HTTP/1.1" 200 -
...

To stop the server, according to the above-mentioned quick and dirty approach, issuing CTRL+C is fine (a traceback will be printed by the Python interpreter, that’s not something to worry about).

Source: http://osxdaily.com/2010/05/07/create-an-instant-web-server-via-terminal-command-line/