shou2017.com
JP

Homebrew formulae, and may need to be deleted.

Fri Aug 9, 2019
Sat Aug 10, 2024

This is a note on how to handle an error that occurred while installing various things using Homebrew.

When I ran the brew doctor command, I got the following warning:

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/node/libplatform/libplatform.h
  /usr/local/include/node/libplatform/v8-tracing.h
  /usr/local/include/node/node.h
  /usr/local/include/node/node_api.h
  /usr/local/include/node/node_api_types.h
  /usr/local/include/node/node_buffer.h
  /usr/local/include/node/node_object_wrap.h

It says I need to delete these files.

I could use vim, but it’s not very easy to use, so I’ll edit with a regular text editor.

$ touch .del_files.sh

Write the files to be deleted in .del_files.sh.

#!/bin/bash
  /usr/local/include/node/libplatform/libplatform.h
  /usr/local/include/node/libplatform/v8-tracing.h
  /usr/local/include/node/node.h
  /usr/local/include/node/node_api.h
  /usr/local/include/node/node_api_types.h
  /usr/local/include/node/node_buffer.h
  /usr/local/include/node/node_object_wrap.h

Then, running bash ~/.del_files.sh will complete the task.

$ bash ~/.del_files.sh

However, when trying to delete npm related files, I got an error like this, so I need to change the permissions of the npm default directory.

$ /Users/boku/.del_files.sh: line 2: /usr/local/include/node/libplatform/libplatform.h: Permission denied
$ npm config get prefix
/usr/local
$ sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

I thought this would solve the issue, but I got another permission error. So I ultimately went with a brute force approach, changing .del_files.sh as follows:

#!/bin/bash
 sudo rm -rf /usr/local/include/node/libplatform/libplatform.h
 sudo rm -rf /usr/local/include/node/libplatform/v8-tracing.h

It seems to have worked.

$ bash ~/.del_files.sh
$ brew doctor
Your system is ready to brew.




See Also