Skip to content

Instantly share code, notes, and snippets.

@clonn
Forked from LeZuse/00_README.md
Created November 25, 2023 15:26
Show Gist options
  • Save clonn/2b0cb455104360aae173c094f4261920 to your computer and use it in GitHub Desktop.
Save clonn/2b0cb455104360aae173c094f4261920 to your computer and use it in GitHub Desktop.

Revisions

  1. @LeZuse LeZuse revised this gist Jan 31, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions 01_install_nvm.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    # Run the install command from a native (ARM) terminal
    # See https://github.com/nvm-sh/nvm#installing-and-updating
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
    # Alternatively install using brew (officially unsupported by nvm):
    # brew install nvm
    # Don't forget to source the command in your shell profile to make it available in new terminals!
  2. @LeZuse LeZuse revised this gist Jan 31, 2021. 3 changed files with 19 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions 02_install_x86.sh
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,10 @@
    # To verify you are running in Rosetta run:
    arch
    -> i386

    # Install node
    nvm install lts/fermium

    # Verify node installation
    nvm use lts/fermium
    node -e 'console.log(process.arch)'
    2 changes: 2 additions & 0 deletions 03_install_arm.sh
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,10 @@
    # To verify you are running natively:
    arch
    -> arm64

    # Install node
    nvm install stable

    # Verify node installation
    nvm use stable
    node -e 'console.log(process.arch)'
    15 changes: 15 additions & 0 deletions 04_handy_alias.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    # To make DX a bit better you can alias your installations:
    nvm alias arm stable
    # arm -> stable (-> v15.6.0)
    nvm alias intel lts/fermium
    # intel -> lts/fermium (-> v14.15.4)

    # To test aliases:
    nvm use arm
    # Now using node v15.6.0 (npm v7.4.0)
    node -e 'console.log(process.arch)'
    -> arm64
    nvm use intel
    # Now using node v14.15.4 (npm v6.14.10)
    node -e 'console.log(process.arch)'
    -> x64
  3. @LeZuse LeZuse revised this gist Jan 31, 2021. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions 00_README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    # Node.js on Apple Silicon
    Node Version Manager (https://github.com/nvm-sh/nvm) works perfectly across native node installations as well as emulated Rosetta installations.
    The trick I am using here is to install one LTS version of node under Rosetta and another stable version as native binary.

    ## TODO
    - find a way how to run the same node version on both platforms
  4. @LeZuse LeZuse created this gist Jan 31, 2021.
    4 changes: 4 additions & 0 deletions 01_install_nvm.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    # Run the install command from a native (ARM) terminal
    # See https://github.com/nvm-sh/nvm#installing-and-updating
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
    # Don't forget to source the command in your shell profile to make it available in new terminals!
    10 changes: 10 additions & 0 deletions 02_install_x86.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    # From Rosetta Terminal (tick checkbox in Terminal right click menu -> Get Info -> Open using Rosetta)
    # To verify you are running in Rosetta run:
    arch
    -> i386
    # Install node
    nvm install lts/fermium
    # Verify node installation
    nvm use lts/fermium
    node -e 'console.log(process.arch)'
    -> x64
    10 changes: 10 additions & 0 deletions 03_install_arm.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    # From native Terminal
    # To verify you are running natively:
    arch
    -> arm64
    # Install node
    nvm install stable
    # Verify node installation
    nvm use stable
    node -e 'console.log(process.arch)'
    -> arm64