我怎么知道我的本地机器上是否有宝石?

时间:2021-01-16 07:10:46

I have the Rails gem and the data_mapper gem installed on my local machine (macbook). When I am in my terminal, I can type which rails and it give me a directory like /Users/andyhuynh/.rvm/gems/ruby-1.9.3-p392/bin/rails.

我在本地计算机(macbook)上安装了Rails gem和data_mapper gem。当我在我的终端时,我可以键入哪个rails,它给我一个像/Users/andyhuynh/.rvm/gems/ruby-1.9.3-p392/bin/rails这样的目录。

However, if I type which data_mapper, I get data_mapper not found. How am I able to figure out what gems I have installed on my local machine? Many thanks for any help!

但是,如果我键入哪个data_mapper,我找不到data_mapper。我怎么能弄清楚我在本地机器上安装了什么宝石?非常感谢您的帮助!

3 个解决方案

#1


2  

How do I know if I have a gem on my local machine?

我怎么知道我的本地机器上是否有宝石?

Type gem list.

输入宝石清单。

#2


1  

You are searching for executable files with which. You can list all gems with gems list or bundle list if you are using bundler.

您正在搜索可执行文件。如果您使用的是捆绑器,则可以列出所有带有宝石列表或捆绑列表的宝石。

You can search for specific gem with gem list | grep gemname or bundle show gemname.

您可以使用gem list搜索特定的gem grep gemname或bundle show gemname。

#3


0  

In case you are using RVM or any other Ruby version manager, you might have it install in other Ruby version.

如果您使用的是RVM或任何其他Ruby版本管理器,您可能会将其安装在其他Ruby版本中。

rvm list

will let you know which version you have installed and which one you are using. Check on other versions with:

会告诉您已安装的版本以及使用的版本。检查其他版本:

rvm use 'ruby_version'

and then

接着

gem list gemname

#1


2  

How do I know if I have a gem on my local machine?

我怎么知道我的本地机器上是否有宝石?

Type gem list.

输入宝石清单。

#2


1  

You are searching for executable files with which. You can list all gems with gems list or bundle list if you are using bundler.

您正在搜索可执行文件。如果您使用的是捆绑器,则可以列出所有带有宝石列表或捆绑列表的宝石。

You can search for specific gem with gem list | grep gemname or bundle show gemname.

您可以使用gem list搜索特定的gem grep gemname或bundle show gemname。

#3


0  

In case you are using RVM or any other Ruby version manager, you might have it install in other Ruby version.

如果您使用的是RVM或任何其他Ruby版本管理器,您可能会将其安装在其他Ruby版本中。

rvm list

will let you know which version you have installed and which one you are using. Check on other versions with:

会告诉您已安装的版本以及使用的版本。检查其他版本:

rvm use 'ruby_version'

and then

接着

gem list gemname