Skip to content

Instantly share code, notes, and snippets.

@guillermoap
Last active September 13, 2019 15:12
Show Gist options
  • Save guillermoap/f186b7de321ea67fe6bbff801569180a to your computer and use it in GitHub Desktop.
Save guillermoap/f186b7de321ea67fe6bbff801569180a to your computer and use it in GitHub Desktop.
Mac os setup for software development

Based on this gist

How to configure your Mac OS for Web/Software Development

  1. Install Sublime Text or Visual Studio Code

  2. Configure text editor

    2.1. Sublime Text

    Create subl command

    sudo mkdir -p /usr/local/bin/ && sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
    

    Install package manager as shown here

    Configure user settings (Sublime Text -> Preferences -> Settings)

    {
      "ensure_newline_at_eof_on_save": true,
      "font_size": 12,
      "show_encoding": true,
      "tab_size": 2,
      "translate_tabs_to_spaces": true,
      "trim_trailing_white_space_on_save": true
    }
    

    2.2. Visual Studio Code

    Create code command Open the Command Palette (⇧⌘P) and type shell command to find the Shell Command: Install 'code' command in PATH command. Restart the terminal for the new $PATH value to take effect. You'll be able to type 'code .' in any folder to start editing files in that folder.

    Configure user settings (⇧⌘P) and type user settings and select Preferences: Open User Settings Depending on your VSCode version you will see a JSON view of the settings by default or not. If it doesn't show at first you can click a {} button on the top right that will show you the settings JSON view.

    {
        "explorer.confirmDelete": false,
        "editor.scrollBeyondLastLine": false,
        "editor.wordWrap": "on",
        "files.trimTrailingWhitespace": true,
        "editor.tabSize": 2,
        "markdown.preview.scrollPreviewWithEditor": false,
        "[python]": {
            "editor.tabSize": 4,
        },
        "files.insertFinalNewline": true,
        "markdown.preview.scrollEditorWithPreview": false,
        "html.suggest.html5": false,
        "editor.quickSuggestions": {
            "other": true,
            "comments": false,
            "strings": true
        },
        "window.zoomLevel": 0,
        "python.venvPath": "~/.virtualenvs",
    }
    
  3. Install Xcode from the AppStore

  4. Open Xcode and accept the licence

  5. Install command line tools. From the terminal run:

    xcode-select --install
    
  6. Install homebrew

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 
    
  7. Run brew doctor

    brew doctor
    
  8. Update homebrew

    brew update
    
  9. Install git

    brew install git
    
  10. Install RVM

    curl -L https://get.rvm.io | bash -s stable --autolibs=enabled
    source ~/.rvm/scripts/rvm
    
  11. Install Ruby and default Ruby version

    rvm use ruby --install --default 
    
  12. Configure no doc

    vim ~/.gemrc
    

    Paste this:

    gem: --no-rdoc --no-ri 
    
  13. Install rails and bundler

    gem install rails bundler
    
  14. Install wget

    brew install wget
    
  15. Install node and npm

    brew install node
    
  16. Configure git (import config if migrating from another computer)

    ssh-keygen -t rsa -C "YOUR GENERATED EMAIL"
    git config --global user.email "YOUR EMAIL"
    git config --global user.name "YOUR NAME"
    git config --global color.ui true
    
  17. Install mysql

    brew install mysql
    brew services start mysql
    
  18. Install Postgres app from here

  19. Install Docker Desktop app from here

  20. Configure PATHs:
    Open bash_profile:

    vim ~/.bash_profile 
    

    Paste the following:

    export PATH=$PATH:/usr/local/bin
    export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
    

    Save those changes and exit.

    Finally, apply those changes:

    source ~/.bash_profile
    
  21. Open psql (type psql in your terminal) and run:

    CREATE USER postgres SUPERUSER;
    
  22. Install python3

    brew install python3
    
  23. Setup python's env management Install virtualenv

    pip3 install virtualenv
    

    Install virtualenvwrapper

    pip3 install virtualenvwrapper
    

    Use the following command to find the location of Python3 on your system

    which python3
    

    Add the following lines to ~/.bash_profile (or your own shell's initialisation file)

    VIRTUALENVWRAPPER_PYTHON='<Python3 location>'
    source /usr/local/bin/virtualenvwrapper.sh
    export WORKON_HOME=$HOME/.virtualenvs
    

    Run the following commands

    mkdir ~/.virtualenvs
    source ~/.bash_profile
    

    All the virtual environments created using virtualenvwrapper will now be stored in ~/.virtualenvs

    To create new Python3 virtual environment

    mkvirtualenv <project name>
    

    The virtualenv will automatically activate after creation

    To exit the virtualenv

    deactivate
    

    To access the virtualenv

    workon <project name>
    
  24. General MAC OS config
    Show Path bar in Finder

    defaults write com.apple.finder ShowPathbar -bool true
    

    Show Status bar in Finder

    defaults write com.apple.finder ShowStatusBar -bool true
    
  25. Other
    Install libxslt

    brew install libxslt
    

    Add aliases:

    vim ~/.gitconfig
    

    Add the following

    [alias]
      tree = log --oneline --decorate --all --graph
      s = status
      backup = "!f() { \
                      BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD); \
                      NEW_BRANCH_NAME=\"${BRANCH_NAME}_backup\"; \
                      git checkout -b $NEW_BRANCH_NAME; \
                      git checkout $BRANCH_NAME; \
              }; f"
      squash = "!f(){ git backup && git reset --soft HEAD~${1} && git commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\"; };f"
    

    Configure git for bash:

    To have the name of the current branch displayed

    Autocomplete for git commands and branches

  26. JUST IF ERRORS APPEAR WHILE BUNDLING:

    gem uninstall libv8
    brew install v8
    gem install therubyracer
    gem install libv8 -v '3.16.14.3' -- --with-system-v8
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment