Skip to content

Instantly share code, notes, and snippets.

@rcugut
Last active July 10, 2023 11:49
Show Gist options
  • Save rcugut/46904124d198a9dbd430abe88ebf849b to your computer and use it in GitHub Desktop.
Save rcugut/46904124d198a9dbd430abe88ebf849b to your computer and use it in GitHub Desktop.

Revisions

  1. rcugut revised this gist Dec 4, 2020. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions [GUIDE] macos yarn nvm install.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,10 @@
    # GUIDE to install yarn, nvm (node) on macOS

    > last update: Apr 6, 2020
    > last update: Dec 4, 2020
    ## Assumptions:

    - macOS >= 10.14 (Mojave)
    - macOS >= 10.14 (Mojave); tested with 10.15 (Catalina)
    - [homebrew](https://brew.sh) properly installed


    @@ -51,20 +51,20 @@ brew install yarn

    Always consult the latest [README (Install section)](https://github.com/nvm-sh/nvm#installation-and-update)

    Install nvm version 0.35.3 (current on APR 2020)
    Install nvm version 0.37.2 (current: Dec 4 2020)
    ```
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
    ```

    Install node latest lts (`erbium`, v12.x, current on Apr 2020)
    Install node latest lts (`fermium`, v14.x, current on Oct 2020)
    ```
    nvm install lts/erbium
    nvm install lts/fermium
    ```

    Set nvm to use latest LTS as default for new bash sessions
    ```
    echo "lts/erbium" > .nvmrc # default to the latest LTS version
    nvm alias default lts/erbium
    echo "lts/fermium" > .nvmrc # default to the latest LTS version
    nvm alias default lts/fermium
    ```


  2. rcugut revised this gist Apr 6, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion [GUIDE] macos yarn nvm install.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # GUIDE to install yarn, nvm (node) on macOS

    > last update: Jul 2019
    > last update: Apr 6, 2020
    ## Assumptions:

  3. rcugut revised this gist Apr 6, 2020. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions [GUIDE] macos yarn nvm install.md
    Original file line number Diff line number Diff line change
    @@ -40,31 +40,31 @@ sudo rm -rf /usr/local/npm_packages # !!! MAKE SURE YOU COPY THIS LINE WITH F


    ## Install yarn via homebrew
    _this section was updated Apr 2020_
    ```
    # install Yarn w/o the node dependency
    # https://github.com/yarnpkg/website/blob/13e95d80282f028ed7b28a822818ce128ea70b7e/lang/en/docs/_installations/mac.md
    brew install yarn --ignore-dependencies # the option --without-node doesn't seem to work anymore >= Feb 2019
    # install Yarn (will install node as a dependency, but that's OK)
    brew install yarn
    ```


    ## Install [`nvm`](https://github.com/creationix/nvm)

    Always consult the latest [README (Install section)](https://github.com/nvm-sh/nvm#installation-and-update)

    Install nvm version 0.34.0 (current on Jul 2019)
    Install nvm version 0.35.3 (current on APR 2020)
    ```
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash
    ```

    Install node latest lts (`dubnium`, v10.x, current on Jul 2019)
    Install node latest lts (`erbium`, v12.x, current on Apr 2020)
    ```
    nvm install lts/dubnium
    nvm install lts/erbium
    ```

    Set nvm to use latest LTS as default for new bash sessions
    ```
    echo "lts/dubnium" > .nvmrc # default to the latest LTS version
    nvm alias default lts/dubnium
    echo "lts/erbium" > .nvmrc # default to the latest LTS version
    nvm alias default lts/erbium
    ```


  4. rcugut revised this gist Jul 31, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion [GUIDE] macos yarn nvm install.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # GUIDE (macOS) yarn, nvm (node)
    # GUIDE to install yarn, nvm (node) on macOS

    > last update: Jul 2019
  5. rcugut revised this gist Jul 31, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion [GUIDE] macos yarn nvm install.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # GUIDE (macOS) yarn, nvm
    # GUIDE (macOS) yarn, nvm (node)

    > last update: Jul 2019
  6. rcugut revised this gist Jul 31, 2019. 1 changed file with 11 additions and 9 deletions.
    20 changes: 11 additions & 9 deletions [GUIDE] macos yarn nvm install.md
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,18 @@
    # GUIDE (macOS) yarn, nvm

    > last update: Jun 2019
    > last update: Jul 2019
    ## Assumptions:

    - macOS >= 10.14 (Mojave)
    - homebrew properly installed
    - [homebrew](https://brew.sh) properly installed


    ## Prepare before setup (cleanup)

    ```
    brew uninstall --force yarn node npm # remove previously installed node, npm, yarn
    brew cleanup # clean all broken symlinks
    brew cleanup # clean all broken symlinks and "waste" (not really required as of homebrew 2019)
    brew update # always good to have the latest
    ```
    ### Cleanup previously installed node/npm config
    @@ -43,33 +43,35 @@ sudo rm -rf /usr/local/npm_packages # !!! MAKE SURE YOU COPY THIS LINE WITH F
    ```
    # install Yarn w/o the node dependency
    # https://github.com/yarnpkg/website/blob/13e95d80282f028ed7b28a822818ce128ea70b7e/lang/en/docs/_installations/mac.md
    brew install yarn --ignore-dependencies # the option --without-node doesn't seem to work anymore @ Feb 2019
    brew install yarn --ignore-dependencies # the option --without-node doesn't seem to work anymore >= Feb 2019
    ```


    ## Install [`nvm`](https://github.com/creationix/nvm)

    Always consult the latest [install docs](https://github.com/creationix/nvm#install-script)
    Always consult the latest [README (Install section)](https://github.com/nvm-sh/nvm#installation-and-update)

    Install nvm version 0.34.0 (current on Jul 2019)
    ```
    # install current 0.34.0 version (Feb 2019)
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
    ```

    Install a node latest lts (currently `dubnium`, v10.x, on Feb 2019)
    Install node latest lts (`dubnium`, v10.x, current on Jul 2019)
    ```
    nvm install lts/dubnium
    ```

    Set nvm to use latest LTS in new shell
    Set nvm to use latest LTS as default for new bash sessions
    ```
    echo "lts/dubnium" > .nvmrc # to default to the latest LTS version
    echo "lts/dubnium" > .nvmrc # default to the latest LTS version
    nvm alias default lts/dubnium
    ```


    ### RESTART all terminals => you're done ;-)



    ## IMPORTANT NOTES

    **NEVER use `sudo`** in any of the commands issued with `node`, `yarn`, or `npm`. If you need global packages installed, just follow nvm guidelines, and do `yarn global add <package>` or `npm install -g <package>`.
  7. rcugut revised this gist Jul 22, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion [GUIDE] macos yarn nvm install.md
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,7 @@ export NODE_PATH....
    ```


    2) delete `~/.npmrc`
    2) delete ".npmrc": `rm -f ~/.npmrc`


    3) delete all existing installed global npm packages (! but make sure to write down if you're using any of them, to reinstall afterwards)
  8. rcugut revised this gist Jun 20, 2019. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions [GUIDE] macos yarn nvm install.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,12 @@
    # GUIDE (macOS) yarn, nvm

    > last update: Jun 2019
    ## Assumptions:

    - macOS >= 10.14 (Mojave)
    - homebrew properly installed


    ## Prepare before setup (cleanup)

  9. rcugut renamed this gist May 10, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  10. rcugut renamed this gist May 10, 2019. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@

    ```
    brew uninstall --force yarn node npm # remove previously installed node, npm, yarn
    brew prune # clean all broken symlinks
    brew cleanup # clean all broken symlinks
    brew update # always good to have the latest
    ```
    ### Cleanup previously installed node/npm config
  11. rcugut revised this gist Feb 4, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion ..GUIDE.. macos yarn nvm install.md
    Original file line number Diff line number Diff line change
    @@ -34,8 +34,9 @@ sudo rm -rf /usr/local/npm_packages # !!! MAKE SURE YOU COPY THIS LINE WITH F

    ## Install yarn via homebrew
    ```
    # install Yarn w/o the node dependency
    # https://github.com/yarnpkg/website/blob/13e95d80282f028ed7b28a822818ce128ea70b7e/lang/en/docs/_installations/mac.md
    brew install yarn --without-node
    brew install yarn --ignore-dependencies # the option --without-node doesn't seem to work anymore @ Feb 2019
    ```


  12. rcugut revised this gist Feb 4, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions ..GUIDE.. macos yarn nvm install.md
    Original file line number Diff line number Diff line change
    @@ -44,11 +44,11 @@ brew install yarn --without-node
    Always consult the latest [install docs](https://github.com/creationix/nvm#install-script)

    ```
    # install current 0.33.11 version
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
    # install current 0.34.0 version (Feb 2019)
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
    ```

    Install a node latest lts (currently `dubnium`, v10.x, on Nov 2018)
    Install a node latest lts (currently `dubnium`, v10.x, on Feb 2019)
    ```
    nvm install lts/dubnium
    ```
  13. rcugut revised this gist Feb 4, 2019. 1 changed file with 10 additions and 7 deletions.
    17 changes: 10 additions & 7 deletions ..GUIDE.. macos yarn nvm install.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    # GUIDE (macOS) yarn, nvm

    # Prepare before setup (cleanup)

    ## Prepare before setup (cleanup)

    ```
    brew uninstall --force yarn node npm # remove previously installed node, npm, yarn
    @@ -30,14 +32,14 @@ sudo rm -rf /usr/local/npm_packages # !!! MAKE SURE YOU COPY THIS LINE WITH F



    # Install yarn via homebrew
    ## Install yarn via homebrew
    ```
    # https://github.com/yarnpkg/website/blob/13e95d80282f028ed7b28a822818ce128ea70b7e/lang/en/docs/_installations/mac.md
    brew install yarn --without-node
    ```


    # Install [`nvm`](https://github.com/creationix/nvm)
    ## Install [`nvm`](https://github.com/creationix/nvm)

    Always consult the latest [install docs](https://github.com/creationix/nvm#install-script)

    @@ -58,14 +60,15 @@ nvm alias default lts/dubnium
    ```


    ## RESTART all terminals => you're done ;-)
    ### RESTART all terminals => you're done ;-)

    # IMPORTANT NOTES
    ## IMPORTANT NOTES

    **NEVER use `sudo`** in any of the commands issued with `node`, `yarn`, or `npm`. If you need global packages installed, just follow nvm guidelines, and do `yarn global add <package>` or `npm install -g <package>`.




    ### EXTRA: add fancy bash prompt to show ruby and node versions
    ...TODO...
    #### EXTRA: add fancy bash prompt to show ruby and node versions
    ...TODO...
    see `.git-prompt-colors.sh`
  14. rcugut revised this gist Nov 21, 2018. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions ..GUIDE.. macos yarn nvm install.md
    Original file line number Diff line number Diff line change
    @@ -46,15 +46,15 @@ Always consult the latest [install docs](https://github.com/creationix/nvm#insta
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
    ```

    Install a node latest lts (currently `carbon`, v8.x, on June 2018)
    Install a node latest lts (currently `dubnium`, v10.x, on Nov 2018)
    ```
    nvm install lts/carbon
    nvm install lts/dubnium
    ```

    Set nvm to use latest LTS in new shell
    ```
    echo "lts/*" > .nvmrc # to default to the latest LTS version
    nvm alias default lts/carbon
    echo "lts/dubnium" > .nvmrc # to default to the latest LTS version
    nvm alias default lts/dubnium
    ```


  15. rcugut revised this gist Nov 21, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ..GUIDE.. macos yarn nvm install.md
    Original file line number Diff line number Diff line change
    @@ -54,7 +54,7 @@ nvm install lts/carbon
    Set nvm to use latest LTS in new shell
    ```
    echo "lts/*" > .nvmrc # to default to the latest LTS version
    nvm alias default lts/*
    nvm alias default lts/carbon
    ```


  16. rcugut revised this gist Jun 12, 2018. 1 changed file with 18 additions and 1 deletion.
    19 changes: 18 additions & 1 deletion ..GUIDE.. macos yarn nvm install.md
    Original file line number Diff line number Diff line change
    @@ -46,8 +46,25 @@ Always consult the latest [install docs](https://github.com/creationix/nvm#insta
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
    ```

    Install a node latest lts (currently `carbon`, v8.x, on June 2018)
    ```
    nvm install lts/carbon
    ```

    Set nvm to use latest LTS in new shell
    ```
    echo "lts/*" > .nvmrc # to default to the latest LTS version
    nvm alias default lts/*
    ```


    ## RESTART all terminals => you're done ;-)

    # IMPORTANT NOTES

    **NEVER use `sudo`** in any of the commands issued with `node`, `yarn`, or `npm`. If you need global packages installed, just follow nvm guidelines, and do `yarn global add <package>` or `npm install -g <package>`.


    # RESTART all terminals => you're done ;-)


    ### EXTRA: add fancy bash prompt to show ruby and node versions
  17. rcugut renamed this gist Jun 12, 2018. 1 changed file with 0 additions and 0 deletions.
  18. rcugut revised this gist Jun 12, 2018. No changes.
  19. rcugut revised this gist Jun 12, 2018. 1 changed file with 38 additions and 0 deletions.
    38 changes: 38 additions & 0 deletions .git-prompt-colors.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    # This theme for gitprompt.sh is designed for dark color schemes
    # it is clone of oh-my-zsh crunch theme style with exit status

    override_git_prompt_colors() {
    GIT_PROMPT_THEME_NAME="CrunchRC"

    if [ -e ~/.rvm/bin/rvm-prompt ]; then
    RUBY_PROMPT='{$(~/.rvm/bin/rvm-prompt v g)}'
    else
    if command -v rbenv > /dev/null; then
    RUBY_PROMPT='{$(rbenv version | sed -e "s/ (set.*$//")}'
    fi
    fi

    NODE_PROMPT='{$(nvm current)}'

    Time12a="\$(date +%H:%M)"

    GIT_PROMPT_STAGED="${Yellow}"
    GIT_PROMPT_UNTRACKED="${Cyan}"
    GIT_PROMPT_STASHED="${BoldMagenta}"
    GIT_PROMPT_CLEAN="${Green}"
    GIT_PROMPT_COMMAND_OK="${Green}"
    GIT_PROMPT_COMMAND_FAIL="${Red}"

    KERNEL_PROMPT='‹$(uname -r)›'

    GIT_PROMPT_START_USER="${Magenta}rvm:${RUBY_PROMPT}; nvm:${NODE_PROMPT}\n_LAST_COMMAND_INDICATOR_${Cyan}${PathShort}${White}:"
    GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}"
    GIT_PROMPT_END_USER="${BoldBlue}${ResetColor}"
    GIT_PROMPT_END_ROOT="${BoldRed} # ${ResetColor}"
    GIT_PROMPT_LEADING_SPACE=0
    GIT_PROMPT_PREFIX="${Green}["
    GIT_PROMPT_SUFFIX="${Green}]"
    GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING=""
    }

    reload_git_prompt_colors "CrunchCustom"
  20. rcugut revised this gist Jun 12, 2018. No changes.
  21. rcugut revised this gist Jun 12, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion macos-yarn-nvm-install.md
    Original file line number Diff line number Diff line change
    @@ -47,6 +47,8 @@ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh |
    ```


    # RESTART all terminals => you're done ;-)

    # EXTRA: add fancy bash prompt to show ruby and node versions

    ### EXTRA: add fancy bash prompt to show ruby and node versions
    ...TODO...
  22. rcugut revised this gist Jun 12, 2018. 1 changed file with 30 additions and 4 deletions.
    34 changes: 30 additions & 4 deletions macos-yarn-nvm-install.md
    Original file line number Diff line number Diff line change
    @@ -6,21 +6,47 @@ brew uninstall --force yarn node npm # remove previously installed node, npm, y
    brew prune # clean all broken symlinks
    brew update # always good to have the latest
    ```
    ### Cleanup previously installed node/npm config

    If you used the instructions [provided in this gist](https://gist.github.com/rcugut/c7abd2a425bb65da3c61d8341cd4b02d), then you need to do some more cleanup:

    # Install [`nvm`](https://github.com/creationix/nvm)
    1) in `~/.bashrc`:
    ```
    # remove all the lines below:
    export NPM_PACKAGES....
    export NODE_PATH....
    # and remove all references to these variables later in the file
    ```


    2) delete `~/.npmrc`

    Always consult the latest [install docs](https://github.com/creationix/nvm#install-script)

    3) delete all existing installed global npm packages (! but make sure to write down if you're using any of them, to reinstall afterwards)
    ```
    # install current 0.33.11 version
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
    # !!! DESTRUCTIVE COMMAND, PAY ATTENTION !!!
    sudo rm -rf /usr/local/npm_packages # !!! MAKE SURE YOU COPY THIS LINE WITH FULL ABSOLUTE PATH COMPLETELY !!!
    ```



    # Install yarn via homebrew
    ```
    # https://github.com/yarnpkg/website/blob/13e95d80282f028ed7b28a822818ce128ea70b7e/lang/en/docs/_installations/mac.md
    brew install yarn --without-node
    ```


    # Install [`nvm`](https://github.com/creationix/nvm)

    Always consult the latest [install docs](https://github.com/creationix/nvm#install-script)

    ```
    # install current 0.33.11 version
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
    ```



    # EXTRA: add fancy bash prompt to show ruby and node versions
    ...TODO...
  23. rcugut created this gist Jun 12, 2018.
    26 changes: 26 additions & 0 deletions macos-yarn-nvm-install.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@

    # Prepare before setup (cleanup)

    ```
    brew uninstall --force yarn node npm # remove previously installed node, npm, yarn
    brew prune # clean all broken symlinks
    brew update # always good to have the latest
    ```


    # Install [`nvm`](https://github.com/creationix/nvm)

    Always consult the latest [install docs](https://github.com/creationix/nvm#install-script)

    ```
    # install current 0.33.11 version
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
    ```


    # Install yarn via homebrew
    ```
    # https://github.com/yarnpkg/website/blob/13e95d80282f028ed7b28a822818ce128ea70b7e/lang/en/docs/_installations/mac.md
    brew install yarn --without-node
    ```