ChatGPT said:
ChatGPT

Step-by-Step Guide for Setting Up Management Libraries in React-Native

1. Install NVM (Node Version Manager)

NVM allows you to manage multiple Node.js versions on a single machine.

Installation:

  • Open Terminal and run the following command:

    bash
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
  • Add the following lines to your .zshrc file:

    bash
    export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
  • To edit .zshrc:

    bash
    sudo nano ~/.zshrc

    After adding the lines, press Ctrl + X, then Y, and Enter to save.

  • Load the changes:

    bash
    source ~/.zshrc
  • Install Node.js versions:

    bash
    nvm install 18 nvm install 16
  • Use a specific Node.js version:

    bash
    nvm use 16 nvm alias default 16

2. Install SDKMAN (SDK Manager)

SDKMAN is a tool for managing parallel versions of multiple Software Development Kits on most Unix-based systems.

Installation:

  • Open Terminal and run the following commands:

    bash
    curl -s "https://get.sdkman.io" | bash source "$HOME/.sdkman/bin/sdkman-init.sh"
  • Add the following lines to your .zshrc file:

    bash
    export SDKMAN_DIR="$HOME/.sdkman" [ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ] && source "$SDKMAN_DIR/bin/sdkman-init.sh"
  • To edit .zshrc:

    bash
    sudo nano ~/.zshrc

    After adding the lines, press Ctrl + X, then Y, and Enter to save.

  • Load the changes:

    bash
    source ~/.zshrc
  • Install Java SDK versions:

    bash
    sdk install java 17.0.8-tem sdk install java 11.0.24-tem
  • Set the default Java version:

    bash
    sdk default java 11.0.24-tem

3. Install ASDF (Another System Definition Facility)

ASDF is a tool to manage multiple runtime versions with a single CLI tool.

Installation:

  • Open Terminal and run the following command:

    bash
    git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.13.1
  • Add the following line to your .zshrc file:

    bash
    . "$HOME/.asdf/asdf.sh"
  • To edit .zshrc:

    bash
    sudo nano ~/.zshrc

    After adding the line, press Ctrl + X, then Y, and Enter to save.

  • Load the changes:

    bash
    source ~/.zshrc
  • Add Ruby plugin and install versions:

    bash
    asdf plugin add ruby asdf install ruby 2.7.8 asdf install ruby 3.1.0
  • Set the global Ruby version:

    bash
    asdf global ruby 3.1.0

4. Install Homebrew

Homebrew is a package manager for macOS (or Linux).

Installation:

  • Open Terminal and run the following command:
    bash
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

5. Install Watchman

Watchman is a tool by Facebook for watching changes in the filesystem. It is needed for tools like Metro and Jest.

Installation:

  • Once Homebrew is installed, run the following command:
    bash
    brew install watchman

6. Install Xcode and CocoaPods

  • Install Xcode: Download and install Xcode from the App Store.

  • Install Xcode command line tools:

    bash
    xcode-select --install
  • Install CocoaPods:

    bash
    sudo gem install cocoapods

1. Cấu hình shell của VS Code

Kiểm tra thiết lập terminal trong VS Code để đảm bảo rằng nó đang dùng đúng shell. Bạn có thể làm theo các bước sau:

  • Mở Settings (Cmd + ,).
  • Tìm đến Terminal: Integrated Shell: OSX.
  • Đảm bảo shell được chọn là /bin/zsh (hoặc shell mà bạn đang dùng trên hệ thống).

Bấm vào Edit in settings.json để mở file cấu hình và thêm dòng sau:

    
"terminal.integrated.defaultProfile.osx": "zsh", "terminal.integrated.env.osx": { "NVM_DIR": "$HOME/.nvm", "PATH": "$NVM_DIR/versions/node/$(nvm current)/bin:$PATH" }