ETC/MacOS,Rancher

Ruby 버전 업데이트

건담아빠 2023. 11. 3. 12:29

 

Homebrew 설치

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

$ brew --version 
    Homebrew 4.1.18
    Homebrew/homebrew-core (git revision 58de0d98e4e; last commit 2023-11-03)
    Homebrew/homebrew-cask (git revision e52e8a2e21; last commit 2023-11-02)

 

Homebrew 최신버전 업데이트

$ brew update

 

rbenv 설치

$ brew install rbenv ruby-build

 

rbenv Ruby 설치 및 관리

Ruby 설치 가능한 버전 확인

$ rbenv install -l
    3.0.6
    3.1.4
    3.2.2
    jruby-9.4.4.0
    mruby-3.2.0
    picoruby-3.0.0
    truffleruby-23.1.1
    truffleruby+graalvm-23.1.1

    Only latest stable releases for each Ruby implementation are shown.
    Use 'rbenv install --list-all / -L' to show all local versions.

 

Ruby 설치

$ rbenv install 3.2.2

 

설치 완료된 버전 리스트

$ rbenv versions
    * system
      3.2.2

 

설치 위치

$ which ruby
	/usr/bin/ruby

 

ruby path 수정

$ vim ~/.zshrc
[[ -d ~/.rbenv  ]] && \
  export PATH=${HOME}/.rbenv/bin:${PATH} && \
  eval "$(rbenv init -)"

 

surce 코드 적용

$ source ~/.zshrc

 

버전 설정

$ rbenv global 3.2.2

rbenv global 3.x.x
rbenv local 3.x.x

 

버전확인

$ ruby --version
	ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin23]

 

 

 

 

Ignoring ffi-1.15.5 because its extensions are not built. Try: gem pristine ffi --version 1.15.5

에러 및 ERROR:  While executing gem ... (Errno::EACCES) 등은 오류 발생 하였을때는 아래와 같이 처리한다.

$ sudo chown -R <your_user> $HOME/.rbenv

$ gem install bundler
    Successfully installed bundler-2.4.21
    Parsing documentation for bundler-2.4.21
    Installing ri documentation for bundler-2.4.21
    Done installing documentation for bundler after 0 seconds
    1 gem installed
    
$ pod update