Skip to content

Instantly share code, notes, and snippets.

@dokterbob
Last active August 13, 2018 00:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dokterbob/6410844 to your computer and use it in GitHub Desktop.
Save dokterbob/6410844 to your computer and use it in GitHub Desktop.
Setting up a Mac system for Python.
  1. Install XCode from the App Store.
  2. Install the XCode command line tools from the 'Downloads' pane in the XCode settings.
  3. Install SublimeText.
  4. Add the following SublimeText configuration options (to User settings):

    // Set to true to insert spaces when tab is pressed
    "translate_tabs_to_spaces": true,
    
    // Columns in which to display vertical rulers
    "rulers": [78],  
    
    // Set to true to removing trailing white space on save
    "trim_trailing_white_space_on_save": true,
    
    // Set to true to ensure the last line of the file ends in a newline
    // character when saving
    "ensure_newline_at_eof_on_save": true
  5. Install SublimeText Package Control.
  6. Install Sublime Linter.
  7. Installing Homebrew:

    ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
  8. Follow Homebrew setup instructions.
  9. Install Python with Homebrew:

    brew install python --framework
  10. Install common Unix packages using Homebrew:

    brew install wget mc bash-completion gnupg graphicsmagick links readline git node
  11. Install HTML5-tidy linter (see https://github.com/Homebrew/homebrew-dupes/pull/150):

    brew install --HEAD tidy
  12. Some additional changes to `~/.bash_profile`:

    # Homebrew over local packages (should only occur once)
    PATH="/usr/local/bin:$PATH"
    
    # --- Make PIP faster
    # Use mirrors when central package repository is down
    PIP_USE_MIRRORS=true
    
    # Use crate.io for the package index export
    PIP_INDEX_URL=https://simple.crate.io/
    
    # Cache previously downloaded packages locally
    PIP_DOWNLOAD_CACHE=~/.pip/download_cache
    
    # Export to make these available in your working environment
    export PIP_USE_MIRRORS PIP_INDEX_URL PIP_DOWNLOAD_CACHE
    
    # --- Homebrew bash completion
    if [ -f $(brew --prefix)/etc/bash_completion ]; then
            . $(brew --prefix)/etc/bash_completion
    fi
    
    # PIP command line completion
    eval "`pip completion --bash`"
    
    # SublimeText 2 as default editor (optional)
    export EDITOR='subl -w'
    
    # Node binaries
    export PATH="/usr/local/share/npm/bin:$PATH"
    
    # Set nice colors for terminal (optional)
    export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
  13. Install Python packages:

    pip install virtualenv ipython Pillow pep8 ipdb South Django Fabric Pygments mercurial surlex sorl-thumbnail readline raven nose lxml gunicorn coverage django-extensions beautifulsoup4 six selenium Sphinx PyYAML docutils WebTest pytz
  14. Install Node.js packages:

    npm install -g jshint require grunt 
  15. Install Ruby packages:

    gem update --system
    gem install compass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment