# change to the directory which your package is installed into
cd /
# remove files
pkgutil --pkgs | grep nodejs | xargs -n 1 pkgutil --only-files --files | xargs -n 1 sudo rm -vf
# remove directories
pkgutil --pkgs | grep nodejs | xargs -n 1 pkgutil --only-dirs --files | xargs -n 1 sudo rmdir
参考文章:https://gist.github.com/githubutilities/b5318d08a4b970d104f1