Mac「ターミナル」のファイル編集時(vi、vim)で「E45: ‘readonly’ option is set (add ! to override)」の対応方法
Macターミナルを使用しファイルの編集(vi)を実施し、保存(wq)を実行した際に「E45: ‘readonly’ option is set (add ! to override)」エラーが発生する場合は以下のコマンドを実行します。
:w !sudo tee %
上記コマンド実行後、以下コマンドを実行
:q!
「:w !sudo tee %」を実行したさいの例が以下となります。
上記エラーから、「esc」キーで抜け、「:w !sudo tee %」を実行します。
:w !sudo tee %
------ 中略 ーーーーーー
W12: Warning: File "/private/etc/bashrc" has changed and the buffer was changed in Vim as well
See ":help W12" for more info.
[O]K, (L)oad File:
:q!
コメント