mac ruby 环境变量_Ruby环境设置| 在Mac和Windows操作系统上安装Ruby

mac ruby 环境变量

Ruby环境设置 (Ruby Environment Setup)

1)在Mac操作系统上安装Ruby (1) Installation of Ruby on Mac Operating System)

Ruby is already included in default macOS installation but it won't be the latest version. In the following steps, we are setting up Ruby Programming Environment using Homebrew. You will have to use the Terminal Application provided macOS.

Ruby已包含在默认的macOS安装中,但它不是最新版本。 在以下步骤中,我们将使用Homebrew设置Ruby编程环境 。 您将必须使用终端应用程序提供的macOS。

Step 1:

第1步:

Install Xcode(An IDE) Command line tool. Though it is not required for writing Ruby programs, Ruby and some of its components will depend upon Xcode's Command Line Tools package. Execute the command given below in the Terminal and these components will be downloaded and installed,

安装Xcode(IDE)命令行工具。 尽管不需要编写Ruby程序,但Ruby及其某些组件将取决于Xcode的Command Line Tools软件包。 在终端中执行下面给出的命令,这些组件将被下载并安装,

 $ xcode-select –install

A prompt will appear to start the installation. Accept the software license and then tools will be downloaded and installed automatically.

出现提示,开始安装。 接受软件许可证,然后将自动下载并安装工具。

Step 2:

第2步:

Install and Set up Homebrew. After installing Xcode, you are ready to install Homebrew (It is a package manager). We will use Homebrew to install the latest version of Ruby and configure our system to use this latest version. Type the following command in the Terminal to install Homebrew.

安装和设置Homebrew。 安装Xcode之后,您就可以安装Homebrew(它是一个程序包管理器)。 我们将使用Homebrew安装最新版本的Ruby,并将我们的系统配置为使用该最新版本。 在终端中键入以下命令以安装Homebrew。

 /usr/bin/ruby -e 

$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install)

$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install)

The script which is downloaded by curl will be executed by default Ruby interpreter. The homebrew installation process will be started. The password prompt will appear. Return to the Terminal by pressing 'Return' key once you've entered your password.

curl下载的脚本将在默认的Ruby解释器中执行。 自制程序安装过程将开始。 出现密码提示。 输入密码后,按“返回”键返回终端。

Press y for Yes, whenever you are required to confirm the installation process. After the installation of Homebrew, we will put the directory Homebrew uses to store its executable files at the front of the PATH environment variables.

在需要确认安装过程时,请按y表示是 。 安装Homebrew之后,我们将把Homebrew用于存储其可执行文件的目录放在PATH环境变量的前面。

Use the nano text editor to create the bash_profile file by typing the following command:

使用nano文本编辑器通过键入以下命令来创建bash_profile文件:

 $ nano ~/.bash_profile

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值