asdf のインストール [M1 macOS 編]
- 2022 8/16
macOS Sierra から High Sierra へアップグレード後、wkhtmltopdf が dyld: Library not loaded: /usr/local/lib/QtWebKit.framework/Versions/4/QtWebKit エラーで動かない問題を解決した話をご紹介します。
MacOS に Homebrew でインストールした PostgreSQL の全バージョンをアンインストールする方法をご紹介します。
Mac で Terminal にて、コマンドが完了したら通知してくれる terminal-notifier が便利なのでご紹介します。
brew update で Error: /usr/local must be writable! がでたときの対応方法です。
$ brew update Error: /usr/local must be writable! |
調べるとまず brew doctor してみてと書いてあったので、やってみます。
$ brew doctor Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry and just ignore them. Thanks! Warning: /usr/local is not writable. You should probably change the ownership and permissions of /usr/local back to your user account. sudo chown -R $(whoami) /usr/local Warning: /usr/local is not writable. Even if this directory was writable when you installed Homebrew, other software may change permissions on this directory. For example, upgrading to OS X El Capitan has been known to do this. Some versions of the "InstantOn" component of Airfoil or running Cocktail cleanup/optimizations are known to do this as well. You should probably change the ownership and permissions of /usr/local back to your user account. sudo chown -R $(whoami) /usr/local Warning: Some installed formula are missing dependencies. You should `brew install` the missing dependencies: brew install oniguruma Run `brew missing` for more details. Warning: Your Homebrew is outdated. You haven't updated for at least 24 hours. This is a long time in brewland! To update Homebrew, run `brew update`. |
sudo chown -R $(whoami) /usr/local しろと書かれているので、実行して brew update を再実行してみます。
sudo chown -R $(whoami) /usr/local |
次は update.sh: line 13: /usr/local/Library/ENV/scm/git: No such file or directory ってエラーが発生しました。
brew update /usr/local/Library/Homebrew/cmd/update.sh: line 13: /usr/local/Library/ENV/scm/git: No such file or directory (略) /usr/local/Library/Homebrew/cmd/update.sh: line 13: /usr/local/Library/ENV/scm/git: No such file or directory Error: update-report should not be called directly! |
brew prune |
たまに brew update すると苦労しますね・・・。
Mac で brew update を実行したら、
$ brew update fatal: cannot create directory at '.github': Permission denied Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master |
というエラーメッセージが表示されたときの対応方法をご紹介します。
fatal: cannot create directory at ‘.github’: Permission denied というエラーメッセージが表示されるのは /usr/local ディレクトリの permission が無いのが原因です。
chown コマンドで所有者を自分に変更しましょう。
$ ls -la /usr/local total 112 drwxr-xr-x 24 root wheel 816 Oct 28 08:47 . |
$ sudo chown $(whoami):admin /usr/local |
$ ls -la /usr/local total 112 drwxr-xr-x 24 myname admin 816 Oct 28 08:47 . |
cd `brew --prefix` git fetch origin git reset --hard origin/master |
$ brew update |
$ brew -v Homebrew 0.9.9 (git revision 145155; last commit 2016-04-23) Homebrew/homebrew-core (git revision bd06; last commit 2016-04-23) |
以上です。
Mac OS X Yosemite で brew コマンドを実行しようとするとエラーが発生しました。
エラー内容
% brew -h /usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory /usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0 |
まず、下記のように ruby の path を 1.8 から current へ変更します。
git diff diff --git a/Library/brew.rb b/Library/brew.rb index 4fa22b4..ee05650 100755 --- a/Library/brew.rb +++ b/Library/brew.rb @@ -1,4 +1,4 @@ -#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -W0 +#!/System/Library/Frameworks/Ruby.framework/Versions/current/usr/bin/ruby -W0 # encoding: UTF-8 std_trap = trap("INT") { exit! 130 } # no backtrace thanks |
次に brew の git repository へ移動して、修正内容を commit します。
cd $(brew --prefix) git add . git commit -m 'Change the path for ruby' brew update |
最後に git commit をしておかないと brew update したときに下記のようにエラーでアップデートできません。
% brew update error: Your local changes to the following files would be overwritten by merge: Library/Formula/mongodb.rb Please, commit your changes or stash them before you can merge. error: Your local changes to the following files would be overwritten by merge: Library/brew.rb Please, commit your changes or stash them before you can merge. Aborting Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master |
brew update で盛大に conflict したときは手元の修正は捨てて、
git reset --hard HEAD git merge -Xtheirs origin/master |
してしまえば OK です。