まず、gitをインストール
$ brew install git 以下省略
いろいろ調べると、rvmを使うとrubyのバージョンが管理できて便利とのことなのでインストールする。
$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
.bash_profileにパスを通す。
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
これでrvmが使える。インストールしてみよう。
$ rvm install 1.9.3-p125 Fetching yaml-0.1.4.tar.gz to /Users/****/.rvm/archives % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 460k 100 460k 0 0 124k 0 0:00:03 0:00:03 --:--:-- 141k Extracting yaml-0.1.4.tar.gz to /Users/****/.rvm/src Configuring yaml in /Users/****/.rvm/src/yaml-0.1.4. Compiling yaml in /Users/****/.rvm/src/yaml-0.1.4. Installing yaml to /Users/****/.rvm/usr Installing Ruby from source to: /Users/****/.rvm/rubies/ruby-1.9.3-p125, this may take a while depending on your cpu(s)... ruby-1.9.3-p125 - #fetching ruby-1.9.3-p125 - #downloading ruby-1.9.3-p125, 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 9505k 100 9505k 0 0 1459k 0 0:00:06 0:00:06 --:--:-- 1630k ruby-1.9.3-p125 - #extracting ruby-1.9.3-p125 to /Users/****/.rvm/src/ruby-1.9.3-p125 ruby-1.9.3-p125 - #extracted to /Users/****/.rvm/src/ruby-1.9.3-p125 ruby-1.9.3-p125 - #configuring ruby-1.9.3-p125 - #compiling ruby-1.9.3-p125 - #installing Retrieving rubygems-1.8.24 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 371k 100 371k 0 0 493k 0 --:--:-- --:--:-- --:--:-- 1874k Extracting rubygems-1.8.24 ... Removing old Rubygems files... Installing rubygems-1.8.24 for ruby-1.9.3-p125 ... Installation of rubygems completed successfully. ruby-1.9.3-p125 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake). ruby-1.9.3-p125 - #importing default gemsets (/Users/****/.rvm/gemsets/) Install of ruby-1.9.3-p125 - #complete
どれどれバージョンチェック。
$ ruby -v ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.4.0]便利だ!
それではherokuを入れてみよう。
$ gem install heroku Fetching: excon-0.14.1.gem (100%) Fetching: heroku-api-0.2.6.gem (100%) Fetching: netrc-0.7.4.gem (100%) Fetching: mime-types-1.19.gem (100%) Fetching: rest-client-1.6.7.gem (100%) Fetching: addressable-2.2.8.gem (100%) Fetching: launchy-2.1.0.gem (100%) Fetching: rubyzip-0.9.9.gem (100%) Fetching: heroku-2.28.2.gem (100%) Successfully installed excon-0.14.1 Successfully installed heroku-api-0.2.6 Successfully installed netrc-0.7.4 Successfully installed mime-types-1.19 Successfully installed rest-client-1.6.7 Successfully installed addressable-2.2.8 Successfully installed launchy-2.1.0 Successfully installed rubyzip-0.9.9 Successfully installed heroku-2.28.2 9 gems installed Installing ri documentation for excon-0.14.1... Installing ri documentation for heroku-api-0.2.6... Installing ri documentation for netrc-0.7.4... Installing ri documentation for mime-types-1.19... Installing ri documentation for rest-client-1.6.7... Installing ri documentation for addressable-2.2.8... Installing ri documentation for launchy-2.1.0... Installing ri documentation for rubyzip-0.9.9... Installing ri documentation for heroku-2.28.2... Installing RDoc documentation for excon-0.14.1... Installing RDoc documentation for heroku-api-0.2.6... Installing RDoc documentation for netrc-0.7.4... Installing RDoc documentation for mime-types-1.19... Installing RDoc documentation for rest-client-1.6.7... Installing RDoc documentation for addressable-2.2.8... Installing RDoc documentation for launchy-2.1.0... Installing RDoc documentation for rubyzip-0.9.9... Installing RDoc documentation for heroku-2.28.2...
入ったかな。heroku listコマンドでアプリケーションを確認する。
$ heroku list Enter your Heroku credentials. Email: ****@***.**.** Password (typing will be hidden): === My Apps ***** ***** *****よしよし、問題なさそう。
herokuからアプリをcloneする場合のコマンドは以下とのことなのでやってみる。
$ git clone git@heroku.com:アプリ名.git Cloning into 'アプリ名'... Warning: Permanently added the RSA host key for IP address '***.***.***.***' to the list of known hosts. Permission denied (publickey). fatal: The remote end hung up unexpectedly
お、失敗した。
どうやらcloneする場合はRSAキーをHerokuに登録しなければならないようだ。
$ heroku keys:add Could not find an existing public key. Would you like to generate one? [Yn] Y Generating new SSH public key. Uploading SSH public key /Users/***/.ssh/***.pub... done
$ git clone git@heroku.com:アプリ名.git Cloning into 'アプリ名'... remote: Counting objects: 95, done. remote: Compressing objects: 100% (79/79), done. remote: Total 95 (delta 20), reused 0 (delta 0) Receiving objects: 100% (95/95), 94.58 KiB | 80 KiB/s, done. Resolving deltas: 100% (20/20), done.
成功。 /home/ユーザー名/ 配下にアプリ名のフォルダができた!
でもこのまま git push heroku master すると失敗するらしくremote addしておく必要があるとのことで以下を入力。
$ git remote add heroku git@heroku.com:アプリ名.git
ここまできたらもうあとはいつものHerokuですね。
$ git add . $ git commit -m 'a' $ git push heroku master
以上、新しいMac環境からのHeroku更新が無事にうまくいきました。いやー、Heroku便利ですねー。