自分用メモ。はたして次使うことはあるのかな。
編集履歴
日付 | 内容 |
---|---|
2018/07/01 | 記事作成。brewとrails追加 |
2018/07/02 | React Native追加 |
2018/07/13 | yarn install時のエラー解消 |
2018/07/21 | sshconfig追加 |
OS
- macOS High Sierra 10.13.5
homebrew
とりあえずこれ。XCodeはAppStoreから事前にインストール済み。
https://brew.sh/index_ja.html
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
rails開発環境
参考: https://qiita.com/is-lab/items/e0443b79da117ed48294
rbenv
# install
brew update
brew install rbenv
# update path
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile
# update rbenv
rm -rf ~/.rbenv/plugins/ruby-build
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
ruby
開発中のアプリでは2.5.0を使用。
rbenv install 2.5.0
rbenv global 2.5.0
bundler
gem install bundler
(git clone myproject)
bundle update
ここで問題発生。postgresのインストールで怒られる。
Installing pg 0.18.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/tocomi/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/pg-0.18.4/ext
/Users/tocomi/.rbenv/versions/2.5.0/bin/ruby -r ./siteconf20180630-22055-1az5ohh.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
libpg-fe.h
ってのが無いって言われているから、これを含むライブラリをインストールすればいいのかな?
とか考えながらググって、結局先にpostgresインストールしちゃえばうまくいくよってので解決。
参考: https://stackoverflow.com/questions/6040583/cant-find-the-libpq-fe-h-header-when-trying-to-install-pg-gem
brew install postgresql
bundle update
bundle install
うまくいった。
node.js
webpacker使うため。nodebrewを使っていくスタイル。
参考: https://qiita.com/Alex_mht_code/items/422f5ce10d9c9d5729b7
brew install nodebrew
nodebrew setup
echo 'export PATH="$HOME/.nodebrew/current/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
nodebrew install-binary stable
nodebrew use stable
yarn
homebrewでyarnとnodeを合わせてインストールできるらしいのでそっちのほうが楽だったかも。
参考: https://yarnpkg.com/lang/ja/docs/install/#mac-stable
npm install -g yarn
yarn install時にエラー発生
参考: https://qiita.com/DQNEO/items/372f20b17af8af8c4d11
yarn install --ignore-engines
React Native
公式サイトに沿って進める。
参考: https://facebook.github.io/react-native/docs/getting-started.html
# nodeはインストール済みなのでスキップ
brew install watchman
(公式サイトを参考にXCodeの設定をする)
npm install -g react-native-cli
sshconfig
自宅サーバーへの接続設定追加。パスワードでのログイン。
vim ~/.ssh/config
Host hoge
HostName fuga
User piyo
Port 22
ServerAliveInterval 60
ここまで
ハードウェアトラブルで早速修理に出すことになったので意外と早く役に立つかもしれない笑