5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MacでRubyの開発環境を整えてhelloを表示するまで

5
Posted at

先日、もくもく勉強会に参加してきた。
そこでやっとの思いでrubyの開発環境を整えることができた。
その過程を記載します!

開発環境を整えるまでの簡単流れ

  1. homebrewインストール
  2. rbenvをインストールする
  3. ruby本体のインストール

(1)OSX用パッケージマネージャー「homebrew」をインストールする
homebrewは、rbenvをインストールするために必要です。

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

(2)rbenvをインストールする
rbenvをインストール
brew install rbenv ruby-build

(3)rbenvをbash_profileに保存し反映

echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
rbenv rehash
source ~/.bash_profile

rbenvがインストールされているか確認
rbenv versions

(4)rubyのインストール(下記の例は ruby本体2.2.4をインストールしています)

rbenv install 2.2.4
rbenv global 2.2.4
ruby -v```

(5)rubyの実行
拡張子「.rb」のtextファイルを作成する

```ruby:hello.rb
puts("hello")

以下のコマンドを入力して実行します

$ ruby hello.rb 

以上です!

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?