13

I am using Mac OS X Yosemite and want to install s3cmd from S3Tools. Here is a summary of what I have done so far:

  1. Downloaded and extracted the .tar.gz.
  2. Moved the resulting directory to /usr/local/src
  3. cd /usr/local/src/s3cmd-1.5.0
  4. sudo python setup.py install
  5. s3cmd --configure, displays error message saying Please install the python dateutil module
  6. Installed Homebrew
  7. brew install python (to install pip)
  8. pip install python-dateutil
  9. s3cmd --configure, or s3cmd du s3://bucket-name

At step 9 I still get the error message about the dateutil module:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
ImportError trying to import dateutil.parser. 
Please install the python dateutil module: 
$ sudo apt-get install python-dateutil
   or 
$ sudo yum install python-dateutil
   or 
$ pip install python-dateutil
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1
  • Hmm worked fine for me, I just did a git clone github.com/s3tools/s3cmd then ran the sudo python setup.py install from that folder
    – Optichip
    Jan 19, 2015 at 12:41

3 Answers 3

26

Or you can keep it simple and use Homebrew to install/manage many of the AWS tools, including s3cmd

  1. Install Homebrew by running this command

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
  2. Look for the code you want

    $ brew search s3
    s3-backer  s3cmd      s3fs   s3sync     unfs3
    
  3. Install s3cmd

    brew install s3cmd
    

The installer will do all of the dirty work including get dependancies and symlink to your /Applications folder (depending on the app you install).

  1. Want the latest version?

    brew update
    

I've been using this for the awscli tools for months with great success. GL.

0
  1. Download the source of python-dateutil
  2. Extract it to, e.g., /usr/local/src/python-dateutil-2.4.0
  3. cd /usr/local/src/python-dateutil-2.4.0 (or whatever directory you extracted it to)
  4. sudo python2.7 setup.py install
  5. s3cmd --configure

(Answering my own question here. If someone can tell me why this works and the previous approach didn't I'd love to know!)

3
  • What is your default system python version? Using version 2.7 instead of 3 might have been all you needed to do.
    – Optichip
    Jan 19, 2015 at 13:03
  • Homebrew doesn't overwrite the OSX installed version of python (which is linked to from /usr/bin/), it installs a new copy in /usr/local/bin. If /usr/bin is before /usr/local/bin in your $path then you'll be using the OSX version of python, not the homebrew one. Also you will have to restart your shell after installing homebrew's python to update the environment variable. Try which python to see what you're actually running.
    – stib
    Jan 19, 2015 at 13:26
  • Thanks both. @Optichip, version 2.7 is the default version. When I run which python I get: /Library/Frameworks/Python.framework/Versions/2.7/bin/python @stib, that's very helpful info, thanks. I guess I'm still a little uncertain why I was previously able to run pip successfully yet not get the dateutils installed. Is it because the only pip installed was the Homebrew version, and so (at step 8) it installed dateutils to the Homebrew python?
    – mpavey
    Jan 19, 2015 at 14:22
0

I didn't want to build it from source, and brew was complaining about needing to update xcode (*sigh)... so I created a docker image instead.

Hope this helps someone.

Usage

# setup
docker run -it --rm -v "$(pwd):/root" mountainpass/s3cmd s3cmd --configure

# run
docker run -it --rm -v "$(pwd):/root" mountainpass/s3cmd s3cmd sync ./yourfolder \
    s3://yourbucket/ \
    --acl-public \
    --add-header=Cache-Control:max-age=3600 \
    --recursive

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .