简体   繁体   English

如何为 MacOS 安装 Toolkit for Ruby

[英]How to install Toolkit for Ruby for MacOS

I need the Gem TK on my Mac with Mojave.我的 Mac 上需要 Gem TK 和 Mojave。 I followed a tutorial that worked for a friend, but she can't explain how she did it anymore.我遵循了一个为朋友工作的教程,但她无法再解释她是如何做到的。

I installed:我安装了:

  • The CommandLine tool命令行工具
  • homebrew rbenv and ruby-build自制 rbenv 和 ruby​​-build
  • Ruby 2.6.2, which is used globally. Ruby 2.6.2,在全球范围内使用。 (ruby -v => 2.6.2) (红宝石 -v => 2.6.2)
  • rbenv init into the shell rbenv init 进入 shell
  • rbenv-doctor rbenv-医生

But I can't get any further with:但我无法进一步了解:

$ bundle install

Neither using Gemfile:既不使用 Gemfile:

source 'https://rubygems.org' do
  gem 'tk'
end

nor without it:也没有它:

$ sudo gem install tk

works.作品。 I get:我得到:

Warning:: cannot find X11 library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options. If your Tcl/Tk don't require X11, please try --without-X11.

I can't find X11 libraries.我找不到 X11 库。 So I can't make tcltklib.so, which is required by Ruby/Tk.所以我不能制作 tcltklib.so,这是 Ruby/Tk 所需要的。 So I installed ActiveTCL and did:所以我安装了 ActiveTCL 并做了:

$ sudo gem install tk

When I start the program, the toolkit opens, and my classes are visible, but I can't execute any methods.当我启动程序时,工具包打开,我的类可见,但我无法执行任何方法。 Everything is black.一切都是黑色的。 With my setup in Windwows, my programm runs perfectly.通过我在 Windwows 中的设置,我的程序运行完美。

Do you know why my toolkit doesn't run flawless?你知道为什么我的工具包不能完美运行吗?

X11 is no longer shipped with macOS [1] . X11 不再随 macOS [1]一起提供。 If it is required by one of your libs, then you can try installing XQuartz .如果您的库之一需要它,那么您可以尝试安装XQuartz This message:这条信息:

Warning:: cannot find X11 library. tcltklib will not be compiled

means, that X11 is required by tk gem.意味着, tk gem 需要 X11。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM