Rails環境のwarningなど – wsl

wsl(Windows Subsystem for Linux)のubuntuでRails環境を構築する際に、いくつかwarningが表示されたのでその対応を簡単に書いておきます。

ちなみに rails は、

rbenv install 2.6.5
rbenv global 2.6.5
gem install rails --no-document

でインストールできた前提です。
ここで例えば、

rails -v

として、

... warning: Insecure world writable dir /home/(username)/.rbenv/bin in PATH, mode 040777

のようなメッセージが表示される場合。

chmod go-w -R ~/.rbenv

として、group や others の書き込み権限を外しておくと良さそうです。同様に、

warning: Insecure world writable dir /mnt/c in PATH, mode 040777

/mnt あたりでパーミッションの問題が表示される場合。

参考:https://github.com/microsoft/WSL/issues/1426

/etc/wsl.conf を開いて(なければ新規作成)、

[automount]
options="metadata,umask=0033"

上記を書いて保存。wsl(ubuntu)のウインドウを一旦閉じて開くと設定が反映されます。wsl.conf の詳細はこちら。

参考:Manage and configure Windows Subsystem for Linux