[kz]anyenvで開発環境を整えてみた。
- 2014.12.06
- engineering
- MacOS

こんにちは、@kazscapeです。
最近、この本が気になっています。
「Rubyによるクローラー開発技法 巡回・解析機能の実装と21の運用例」という本なのですが、インターネット上の情報を巡回して、必要な情報を取得するというプログラミング言語Rubyを使った技法に関する本です。
ということで、プログラミング言語Rubyの開発環境を用意します。
anyenvのインストール
Rubyだけをインストールすればよいのだけれど、先々、PythonやPerlもやってみたくなるかもなので、OSにインストールされている環境を汚さずにそれらをプログラミング開発環境を管理することできる「anyenv」をインストールしてみる。
以下のコマンドでまずは「anyenv」のインストールをします。
1 |
git clone https://github.com/riywo/anyenv ~/.anyenv |
これだけだとPATHが通っていないので、.zshrcに以下を追記します。
1 |
if [ -d $HOME/.anyenv ] ; then export PATH="$HOME/.anyenv/bin:$PATH" eval "$(anyenv init -)" fi |
.zshrcを読み込ませます。
1 |
source ~/.zshrc |
「anyenv」とコマンドを入力したら、以下のUsageが表示されれば、anyenvのインストールは終了です。
1 2 3 4 5 6 7 8 9 10 11 12 13 |
anyenv Usage: anyenv <command> [<args>] ome useful anyenv commands are: commands List all available anyenv commands local Show the local application-specific Any version global Show the global Any version install Install a **env version Show the current Any version and its origin versions List all Any versions available to **env See `anyenv help <command>' for information on a specific command. For full documentation, see: https://github.com/riywo/anyenv#readme |
rbenvのインストール
インストールしたanyenvを使って、Rubyの開発環境を管理するrbenvをインストールします。
1 |
anyenv install rbenv |
以下のメッセージが出力されれば、インストールは成功。
1 |
Install rbenv succeeded! Please reload your profile (exec $SHELL -l) or open a new session. |
言われるがままに、以下のコマンドを入力して、プロファイルをリロードしましょう。
1 |
exec $SHELL -l |
「rbenv」と入力して、以下のUsageが表示されれば、rbenvもインストール終了です。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
rbenv 0.4.0-129-g7e0e85b Usage: rbenv <command> [<args>] Some useful rbenv commands are: commands List all available rbenv commands local Set or show the local application-specific Ruby version global Set or show the global Ruby version shell Set or show the shell-specific Ruby version install Install a Ruby version using ruby-build uninstall Uninstall a specific Ruby version rehash Rehash rbenv shims (run this after installing executables) version Show the current Ruby version and its origin versions List all Ruby versions available to rbenv which Display the full path to an executable whence List all Ruby versions that contain the given executable See `rbenv help <command>' for information on a specific command. For full documentation, see: https://github.com/sstephenson/rbenv#readme |
本題のRubyのインストール
ここまできて、やっとこさRubyのインストールです。
現在のRubyの最新版は2.1.5になります。最新という言葉が大好きな私はやはり最新の2.1.5をインストールします。
1 |
rbenv install 2.1.5 |
最後に、インストールしたバージョン2.1.5を使用するようにします。
1 |
rbenv global 2.1.5 |
まとめ
これにてRubyのインストールは終了です。
あ〜っ、満足してしまった。
何したかったんだっけ?あっ、本買わなきゃ。。。
-
前の記事
[kz]Yahoo!キーボードを使ってみました。 2014.12.04
-
次の記事
[kz] Nickelback “No Fixed Address” 抜群の安定感 2014.12.07
Advertisement

コメントを書く