環境は、MacBook ProのMavericks(10.9.2)です。
昔、Railsの記事を書いていた時があるし、RubyとかRails入ってたよなーとか思いながらチェックしたけど、Railsなんてインストールされてなかった。
よくよく考えてみたら、OSをクリーンインストールとかしてたから、消えちゃったのかも。。
と思って、あらためてRuby環境から作り直す。
まずはRVMのインストール。
本家サイトに書いてある方法に従う。
$ curl -L get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 184 100 184 0 0 270 0 --:--:-- --:--:-- --:--:-- 270
100 20511 100 20511 0 0 16292 0 0:00:01 0:00:01 --:--:-- 241k
Downloading https://github.com/wayneeseguin/rvm/archive/stable.tar.gz
Installing RVM to /Users/***/.rvm/
Adding rvm PATH line to /Users/***/.profile /Users/***/.bashrc /Users/***/.zshrc.
RVM sourcing line found in /Users/***/.zshrc.
RVM sourcing line not found for Bash, rerun this command with '--auto-dotfiles' flag to fix it.
Installation of RVM in /Users/***/.rvm/ is almost complete:
* To start using RVM you need to run `source /Users/***/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
# ***,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.
In case of problems: http://rvm.io/help and https://twitter.com/rvm_io
ここまではいいんだけど、次の手順で、以下を.bashrcに設定しろって言われてる。
[ -s ${HOME}/.rvm/scripts/rvm ] && source ${HOME}/.rvm/scripts/rvm
そもそもzsh使っているのに。。
と思って
ぐぐったら、zshrcにも設定できた。
$ source ~/.rvm/scripts/rvm
これで、zshrcを再読み込みして、起動
$ source ~/.zshrc
いよいよRubyのインストール。
$ rvm install 1.9.2
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.9/x86_64/ruby-1.9.2-p320.
It is not possible to build movable binaries for rubies 1.8-1.9.2, but you can do it for your system only.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Installing requirements for osx.
Updating system - please wait
Error running 'requirements_osx_port_update_system ruby-1.9.2-p320',
showing last 15 lines of /Users/***/.rvm/log/1398601968_ruby-1.9.2-p320/update_system.log
checking whether rl_username_completion_function is declared... no
checking whether rl_filename_completion_function is declared... yes
checking whether rl_completion_matches is declared... yes
checking whether username_completion_function is declared... yes
checking whether filename_completion_function is declared... yes
checking whether completion_matches is declared... yes
checking for Tcl configuration... configure: error: Can't find Tcl configuration definitions
Command failed: cd /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/base && CC=/usr/bin/cc ./configure --prefix=/opt/local --with-tclpackage=/Library/Tcl --with-install-user=root --with-install-group=admin --with-directory-mode=0755 --enable-readline && make && make install SELFUPDATING=1
Exit code: 1
DEBUG: Error installing new MacPorts base: command execution failed
while executing
"macports::selfupdate [array get global_options] base_updated"
Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: command execution failed
+__rvm_try_sudo:48> return 1
+requirements_osx_port_update_system:2> return 1
Requirements installation failed with status: 1.
エラーしました。何のエラーだろ?MacPortsとか出てるし…
ぐぐったら、MacPortsのアップデートに失敗したときに表示されるメッセージらしく、コマンドラインツールのインストールが必要らしい。
以下コマンドを実行し、ダイアログで「インストール」を選択する。
$ sudo xcode-select --install
xcode-select: note: install requested for command line developer tools
もう一回実行したら、成功した!
$ rvm install 1.9.2
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.9/x86_64/ruby-1.9.2-p320.
It is not possible to build movable binaries for rubies 1.8-1.9.2, but you can do it for your system only.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Installing requirements for osx.
Updating system - please wait
Installing required packages: curl-ca-bundle, autoconf, automake, libtool, pkgconfig, apple-gcc42, libiconv, libyaml, libffi, readline, libksba, openssl, sqlite3, zlib, gdbm, ncurses - please wait
Updating certificates in '/opt/local/etc/openssl/cert.pem'.
*** password required for 'mv -f /var/folders/5j/g68tsznn7wxgzrr008w1dc3h0000gp/T//tmp.3DZfmE03Q2GoC9I02F /opt/local/etc/openssl/cert.pem':
Requirements installation successful.
Installing Ruby from source to: /Users/***/.rvm/rubies/ruby-1.9.2-p320, this may take a while depending on your cpu(s)...
ruby-1.9.2-p320 - #downloading ruby-1.9.2-p320, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8770k 100 8770k 0 0 258k 0 0:00:33 0:00:33 --:--:-- 362k
ruby-1.9.2-p320 - #extracting ruby-1.9.2-p320 to /Users/***/.rvm/src/ruby-1.9.2-p320 - please wait
ruby-1.9.2-p320 - #applying patch /Users/***/.rvm/patches/ruby/GH-488.patch - please wait
ruby-1.9.2-p320 - #configuring - please wait
ruby-1.9.2-p320 - #post-configuration - please wait
ruby-1.9.2-p320 - #compiling - please wait
ruby-1.9.2-p320 - #installing - please wait
ruby-1.9.2-p320 - #making binaries executable - please wait
ruby-1.9.2-p320 - #downloading rubygems-2.2.2
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 404k 100 404k 0 0 181k 0 0:00:02 0:00:02 --:--:-- 181k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-1.9.2-p320 - #extracting rubygems-2.2.2 - please wait
ruby-1.9.2-p320 - #removing old rubygems - please wait
ruby-1.9.2-p320 - #installing rubygems-2.2.2 - please wait
ruby-1.9.2-p320 - #gemset created /Users/***/.rvm/gems/ruby-1.9.2-p320@global
(eval):1: bad pattern: #*[[:space:]]+([[:space:]])
(eval):1: bad pattern: #*[[:space:]]+([[:space:]])
(eval):1: bad pattern: #*[[:space:]]+([[:space:]])
(eval):1: bad pattern: #*[[:space:]]+([[:space:]])
(eval):1: bad pattern: #*[[:space:]]+([[:space:]])
ruby-1.9.2-p320 - #importing gemset /Users/***/.rvm/gemsets/global.gems - please wait
ruby-1.9.2-p320 - #generating global wrappers - please wait
ruby-1.9.2-p320 - #gemset created /Users/***/.rvm/gems/ruby-1.9.2-p320
ruby-1.9.2-p320 - #importing gemsetfile /Users/***/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-1.9.2-p320 - #generating default wrappers - please wait
ruby-1.9.2-p320 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-1.9.2-p320 - #complete
WARNING: Please be aware that you just installed a ruby that is no longer maintained (2014-02-23), for a list of maintained rubies visit:
http://bugs.ruby-lang.org/projects/ruby/wiki/ReleaseEngineering
Please consider upgrading to ruby-2.1.1 which will have all of the latest security patches.
Ruby was built without documentation, to build it run: rvm docs generate-ri