Scroll to top
Khắc phục lỗi "The Ruby openssl extension was not compiled." khi cài Ruby 3.2.0

Khắc phục lỗi "The Ruby openssl extension was not compiled." khi cài Ruby 3.2.0

ByAdmin 2022-12-29 12:54
1 min read

Hướng dẫn khắc phục lỗi "The Ruby openssl extension was not compiled." khi cài đặt Ruby phiên bản 3.2.0.

Môi trường

  • MacBook Pro M1 Max
  • macOS 13.1 (Ventura)
  • rbenv 1.2.0-50-g593f820

Vấn đề

Trong khi cài đặt Ruby 3.2.0 thì xuất hiện lỗi sau:

Copy zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Inspect or clean up the working tree at /var/folders/49/nz02t3_136xgn4jlw6z9r1q40000gn/T/ruby-build.20221229163135.84880.33u6aF
Results logged to /var/folders/49/nz02t3_136xgn4jlw6z9r1q40000gn/T/ruby-build.20221229163135.84880.log

Last 10 log lines:
ERROR: Ruby install aborted due to missing extensions
Configure options used:
  --prefix=/Users/yuto/.anyenv/envs/rbenv/versions/3.2.0
  --enable-shared
  --with-readline-dir=/opt/homebrew/opt/readline
  --with-gmp-dir=/opt/homebrew/opt/gmp
  --with-openssl-dir=/usr/local/opt/[email protected]
  CC=clang
  LDFLAGS=-L/Users/yuto/.anyenv/envs/rbenv/versions/3.2.0/lib -L/opt/homebrew/opt/imagemagick@6/lib
  CPPFLAGS=-I/Users/yuto/.anyenv/envs/rbenv/versions/3.2.0/include -I/opt/homebrew/opt/imagemagick@6/include

Sau khi đọc log để tìm lỗi thì mình phát hiện lỗi như sau:

Copy zsh
1
The Ruby openssl extension was not compiled.

Do đó mình nghĩ lỗi phát sinh liên quan đến openssl

Cách khắc phục

Cài đặt lại openssl, readline, libyaml

Copy zsh
1
brew uninstall [email protected] readline libyaml

Sau đó mình đã cài đặt thành công Ruby 3.2.0 bằng lệnh sau:

Copy zsh
1
2
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])"
rbenv install 3.2.0
Đánh giá bài viết: 4.9/5 (45 đánh giá)
Bạn chưa đánh giá

Bình luận

Author
hoclaptrinh.io author
Tác giả:Yuto Yasunaga

Mình là một full stack developer, tốt nghiệp và làm việc tại Nhật Bản. Trang web này là nơi mình tổng hợp, đúc kết và lưu trữ lại những kiến thức trong quá trình học và làm việc liên quan đến IT.
Hy vọng những bài viết ở website này sẽ có ích cho bạn.