LoginSignup
0
0

More than 5 years have passed since last update.

29日目 Railsのインストール

Last updated at Posted at 2019-04-07

Ruby on Railsを使う事になったので
gem install rails でインストールしてみました。

$ gem install rails
Fetching: concurrent-ruby-1.1.5.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

さっそくエラー!

同じケース
https://teratail.com/questions/74708

$ which ruby 
/usr/bin/ruby
$ which bundle
/usr/local/bin/bundle

rubyとbundleのパスが違うとエラーになるらしい。
先月rubyをインストールした時のログをみると、

$ which ruby 
/Users/robamimim/.rbenv/shims/ruby
$ which bundle
/Users/robamimim/.rbenv/shims/bundle

あれれ???
なんでだろう・・・?

.bash_profileを確認。

15:45:38 ~ $ cat .bash_profile
# added by Anaconda3 5.3.0 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<
#eval "$(rbenv init -)"export PATH=$HOME/.nodebrew/current/bin:$PATH
export PATH=$HOME/.nodebrew/current/bin:$PATH
export NODEBREW_ROOT=/usr/local/var/nodebrew
export PATH=/usr/local/var/nodebrew/current/bin:$PATH

あれっ???
コメントアウトしている?なんでそうしたんだっけ。
思い出せないので、コメントを戻してソース。

15:45:48 ~ $ vi .bash_profile
15:46:57 ~ $ 
15:46:58 ~ $ 
15:46:58 ~ $ source ~/.bash_profile
-bash: eval: line 35: syntax error: unexpected end of file
15:47:15 ~ $ which ruby 
/Users/robamimim/.rbenv/shims/ruby
15:47:24 ~ $ which bundle
/Users/robamimim/.rbenv/shims/bundle
15:47:32 ~ $ 

OK、パス通った。
もう一度。

15:48:45 ~ $ gem install rails
Fetching: activesupport-5.2.3.gem (100%)
Successfully installed activesupport-5.2.3
Fetching: actionview-5.2.3.gem (100%)
Successfully installed actionview-5.2.3
Fetching: actionpack-5.2.3.gem (100%)
Successfully installed actionpack-5.2.3
Fetching: activemodel-5.2.3.gem (100%)
Successfully installed activemodel-5.2.3
Fetching: activerecord-5.2.3.gem (100%)
Successfully installed activerecord-5.2.3
Fetching: activejob-5.2.3.gem (100%)
Successfully installed activejob-5.2.3
Fetching: actionmailer-5.2.3.gem (100%)
Successfully installed actionmailer-5.2.3
Fetching: actioncable-5.2.3.gem (100%)
Successfully installed actioncable-5.2.3
Fetching: activestorage-5.2.3.gem (100%)
Successfully installed activestorage-5.2.3
Fetching: railties-5.2.3.gem (100%)
Successfully installed railties-5.2.3
Fetching: rails-5.2.3.gem (100%)
Successfully installed rails-5.2.3
Parsing documentation for activesupport-5.2.3
Installing ri documentation for activesupport-5.2.3
Parsing documentation for actionview-5.2.3
Installing ri documentation for actionview-5.2.3
Parsing documentation for actionpack-5.2.3
Installing ri documentation for actionpack-5.2.3
Parsing documentation for activemodel-5.2.3
Installing ri documentation for activemodel-5.2.3
Parsing documentation for activerecord-5.2.3
Installing ri documentation for activerecord-5.2.3
Parsing documentation for activejob-5.2.3
Installing ri documentation for activejob-5.2.3
Parsing documentation for actionmailer-5.2.3
Installing ri documentation for actionmailer-5.2.3
Parsing documentation for actioncable-5.2.3
Installing ri documentation for actioncable-5.2.3
Parsing documentation for activestorage-5.2.3
Installing ri documentation for activestorage-5.2.3
Parsing documentation for railties-5.2.3
Installing ri documentation for railties-5.2.3
Parsing documentation for rails-5.2.3
Installing ri documentation for rails-5.2.3
Done installing documentation for activesupport, actionview, actionpack, activemodel, activerecord, activejob, actionmailer, actioncable, activestorage, railties, rails after 25 seconds
11 gems installed
15:49:18 ~ $ 

できました!

しかし、ここからが本番なのでした・・・
(続く)
29日目 その2 Ruby on Railsを起動したい!

0
0
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
0
0