Friday, January 2, 2015

Mac OSX Context Menu FTP Upload

If you’ve ever wanted to know how to FTP a file to a remote server via a right-click context menu in OS X, then continuing reading! As a bonus, I’ll add a desktop notification once the upload is completed.

What you will need:

  • Mac OS X
  • Automator
  • Curl
  • Remote FTP server, and client
  • Ruby (for desktop notification via terminal-notifier)


The first thing you want to do is install the terminal-notifier so you can receive desktop alerts after your upload is completed. Ensure you have Ruby installed, and then run the install command from Terminal.

sudo gem install terminal-notifier

Next, make sure your have a remote directory to upload your files too. I used FileZilla as my FTP client to create a remote directory on my website, named “shared”. I won’t go in depth into creating remote directories on FTP servers. If you need me to, please comment below.

Next, we use Automator to create a shell script that we can use to upload our files to our newly create FTP directory. In your Applications folder, open the Automator App. Select the ‘Service’ as your document type.

Under ‘Actions’ look for the ‘Run Shell Script’ option (alternatively you can use the search box to type in ‘run shell script’). In the script editor drop down the ‘Service receives selected’ menu and select “file and folders”

In the ‘Run Shell Script’ editor paste the following script:

for f in "$@" 
 fileName=$(basename "$f")
 printf "Uploading file: $f \n FILENAMED: $fileName \n\n"
 curl -u [username]:[password] “ftp://[your ftp site]/[directory]/$fileName" -T "$f"
 terminal-notifier -message "Upload of $f to FTP completed" -title "Upload Status" -open "http://[your ftp site]/[directory]/$fileName"


Replace the following text with your own:
  • [username] : your FTP site’s user id 
  • [password] : your FTP site’s password 
  • [your ftp site] : your FTP site’s URL 
  • [directory] : the folder path you plan on uploading files too
When you’ve configured the script, and saved it, you’ll be prompted to give it a name. I’ve named mine “Upload to FTP”. When finished you should have a new menu option on your Finder’s right-click context menu. When you right-click a file and select “Upload to FTP”, the file will be uploaded to your FTP site’s folder!

Thanks to the following sites I used for reference:


No comments: