[LINUX] We will solve the warnings that occurred when the brew doctor command was executed one by one!

Introduction

When I checked Homebrew for problems with the brew doctor command, problems overflowed, so I solved them one by one.

Environment at the time of error

macOS Catalina version 10.15.4 Xcode version 11.4

error contents

$ 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 or file an issue; just ignore this. Thanks!

#First error
 Warning: A newer Command Line Tools release is available.
 Update them from Software Update in System Preferences or run:
   softwareupdate --all --install --force

#Second error
 Warning: You have unlinked kegs in your Cellar.
 Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
 those kegs to fail to run properly once built. Run `brew link` on these:
   node

#Third error
 Warning: Your Xcode (11.4) is outdated.
 Please update to Xcode 11.4.1 (or delete it).
 Xcode can be updated from the App Store.

First error

Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

$ softwareupdate --all --install --force You are instructed to execute the command, so execute it.

$ softwareupdate --all --install --force

→ If this does not solve the problem, install the latest version at App Developer.

Second error

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
   node

→ This also says that you should execute $ brew link to node```, so execute the command according to the instructions.

$ brew link node
Error: Could not symlink share/doc/node/gdbinit
Target /usr/local/share/doc/node/gdbinit
already exists. You may want to remove it:
    rm '/usr/local/share/doc/node/gdbinit'

To force the link and overwrite all conflicting files:
    brew link --overwrite node

To list all files that would be deleted:
    brew link --overwrite --dry-run node

→ However, I got the above error. → I was instructed to delete or forcibly overwrite the target file because I can't create a symlink in the share / doc / node / gdbinit file. (For those who are wondering what a symbolic link is, this article will be very helpful.) → Then, execute the $ brew link --overwrite node command as instructed.

$ brew link --overwrite node
Error: Could not symlink share/doc/node/gdbinit
/usr/local/share/doc/node is not writable.

→ And error again. The `` `/ usr / local / share / doc / nodedirectory is said to beis not writable```, that is, you do not have write permission, so give the user permission to write to this directory. Delegate to the current account. → To make it writable, execute the command as follows.

$ cd /usr/local/share/doc
$ sudo chown -R $USER node
Password:

→ First, move to the doc directory` `` where the node directory is located. → By delegating user authority to the current account with the chown command``, you are given write permission to the directory (for the chown command, see this article](https://webkaru.net). / linux / chown-command /) will be helpful). → If you are prompted to enter the password as described above, enter the password you set when you logged in to your PC. → Now that it is writable, execute the ``$ brew link``` command again.

$ brew link --overwrite node
Linking /usr/local/Cellar/node/14.2.0... 
Error: Could not symlink share/systemtap/tapset/node.stp
/usr/local/share/systemtap/tapset is not writable.

→ However, this time I got an error saying that I do not have write permission for another file. → I want to make this also writable, so give write permission in the same way as the previous procedure.

$ cd /usr/local/share/systemtap
$ sudo chown -R $USER tapset

→ Move to the `systemtap directory` where the tapset directory is located. → Use the chown command` to delegate user privileges to the current account and enable writing. → Then execute the $ brew link command.

$ brew link --overwrite node
Linking /usr/local/Cellar/node/14.2.0... 
Error: Could not symlink lib/dtrace/node.d
/usr/local/lib/dtrace is not writable.

→ Again, like the above two errors, I got an error saying that I do not have write permission. → Similarly, give write permission to the directory.

$ cd /usr/local/lib
$ sudo chown -R $USER dtrace

→ Move to the lib directory` `` where the distrace directory is located. → Transfer user privileges to the current account with the chown command` . → Then execute the $ brew link``` command.

$ brew link --overwrite node
Linking /usr/local/Cellar/node/14.2.0... 7 symlinks created

→ It seems that the link was successfully established this time (good ...).

By the way

__ * When executing the chown command, the error "Operation not permitted" may appear. If this happens, please refer to the following. __ (I faced this situation)

solution

__ This can be solved by changing the terminal environment settings themselves, so I will explain the procedure. __

  1. Mac "Open System Preferences" ![Screenshot 2020-05-17 10.58.29.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/606750/60ad97c8-f2b0-b017-a34f- f9b921230f62.png)
  2. Open the "Privacy" tab on the right.
  3. Scroll left to open "Full Disk Access".
  4. Press the "+" mark, search for "terminal", select the terminal and check it (if you cannot change it, you can change it by clicking the lock mark at the bottom left). スクリーンショット 2020-05-17 10.59.51.png

The story was derailed, but the third error was fixed.

Warning: Your Xcode (11.4) is outdated.
Please update to Xcode 11.4.1 (or delete it).
Xcode can be updated from the App Store.

→ Follow the instructions to update Xcode to 11.4.1. → Download and install Xcode 11.4.1 from App Developer. → Move the installed Xcode file under the Applications directory. → __ If the above doesn't fix the Xcode update error, try the following methods. __

  1. Open Xcode.app.
  2. From the Xcode tab, select Preferences to open it. ![Screenshot 2020-05-17 16.51.02.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/606750/4898b9d4-a25b-9fe4-f0ad- 643030fd0e8a.png)
  3. Open the Location tab and change the Command Line Tools field to the newly installed version of Xcode. スクリーンショット 2020-05-17 16.49.45.png

I think that the error correction is completed, so let's check it with the $ brew doctor command.

$ brew doctor
Your system is ready to brew.

→ It went well!

reference

https://wtnvenga.hatenablog.com/entry/2017/11/15/125430 → It was very helpful for errors related to symlink.

https://gori.me/mac/mac-tips/112082 → It was helpful in the terminal settings.

Recommended Posts

We will solve the warnings that occurred when the brew doctor command was executed one by one!
[Linux / GCP] Corrected the error that occurred when using the Git command.