Skip to content

Instantly share code, notes, and snippets.

@apainintheneck
Created April 23, 2023 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apainintheneck/32d3f45ab33bb66e8c64b922592ecdbc to your computer and use it in GitHub Desktop.
Save apainintheneck/32d3f45ab33bb66e8c64b922592ecdbc to your computer and use it in GitHub Desktop.
The caveats functions that don't currently work the Homebrew JSON API.
[./Formula/gawk.rb]
def caveats
on_macos do
<<~EOS
GNU "awk" has been installed as "gawk".
If you need to use it as "awk", you can add a "gnubin" directory
to your PATH from your ~/.bashrc and/or ~/.zshrc like:
PATH="#{opt_libexec}/gnubin:$PATH"
EOS
end
end
[./Formula/apcupsd.rb]
def caveats
on_macos do
<<~EOS
For #{name} to be able to communicate with UPSes connected via USB,
the kernel extension must be installed by the root user:
sudo cp -pR #{kext_prefix}/ApcupsdDummy.kext /System/Library/Extensions/
sudo chown -R root:wheel /System/Library/Extensions/ApcupsdDummy.kext
sudo touch /System/Library/Extensions/
Note: On OS X El Capitan and above, the kernel extension currently
does not work as expected.
You will have to unplug and plug the USB cable back in after each
reboot in order for #{name} to be able to connect to the UPS.
To load #{name} at startup, activate the included Launch Daemon:
sudo cp #{prefix}/lib/Library/LaunchDaemons/org.apcupsd.apcupsd.plist /Library/LaunchDaemons
sudo chmod 644 /Library/LaunchDaemons/org.apcupsd.apcupsd.plist
sudo launchctl load -w /Library/LaunchDaemons/org.apcupsd.apcupsd.plist
If this is an upgrade and you already have the Launch Daemon loaded, you
have to unload the Launch Daemon before reinstalling it:
sudo launchctl unload -w /Library/LaunchDaemons/org.apcupsd.apcupsd.plist
sudo rm /Library/LaunchDaemons/org.apcupsd.apcupsd.plist
EOS
end
end
[./Formula/util-linux.rb]
def caveats
linux_only_bins = %w[
addpart agetty
blkdiscard blkzone blockdev
chcpu chmem choom chrt ctrlaltdel
delpart dmesg
eject
fallocate fdformat fincore findmnt fsck fsfreeze fstrim
hwclock
ionice ipcrm ipcs
kill
last ldattach losetup lsblk lscpu lsipc lslocks lslogins lsmem lsns
mount mountpoint
nsenter
partx pivot_root prlimit
raw readprofile resizepart rfkill rtcwake
script scriptlive setarch setterm sulogin swapoff swapon switch_root
taskset
umount unshare utmpdump uuidd
wall wdctl
zramctl
]
on_macos do
<<~EOS
The following tools are not supported for macOS, and are therefore not included:
#{Formatter.columns(linux_only_bins)}
EOS
end
end
[./Formula/uutils-coreutils.rb]
def caveats
provided_by = "coreutils"
on_macos do
provided_by = "macOS"
end
<<~EOS
Commands also provided by #{provided_by} have been installed with the prefix "u".
If you need to use these commands with their normal names, you
can add a "uubin" directory to your PATH from your bashrc like:
PATH="#{opt_libexec}/uubin:$PATH"
EOS
end
[./Formula/firefoxpwa.rb]
def caveats
filename = "firefoxpwa.json"
source = opt_share
destination = "/Library/Application Support/Mozilla/NativeMessagingHosts"
on_linux do
destination = "/usr/lib/mozilla/native-messaging-hosts"
end
<<~EOS
To use the browser extension, manually link the app manifest with:
sudo mkdir -p "#{destination}"
sudo ln -sf "#{source}/#{filename}" "#{destination}/#{filename}"
EOS
end
[./Formula/mysql.rb]
def caveats
s = <<~EOS
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -u root
EOS
if (my_cnf = ["/etc/my.cnf", "/etc/mysql/my.cnf"].find { |x| File.exist? x })
s += <<~EOS
A "#{my_cnf}" from another install may interfere with a Homebrew-built
server starting up correctly.
EOS
end
s
end
[./Formula/openjdk.rb]
def caveats
on_macos do
<<~EOS
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn #{opt_libexec}/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
EOS
end
end
[./Formula/llvm@14.rb]
def caveats
on_macos do
<<~EOS
To use the bundled libc++ please add the following LDFLAGS:
LDFLAGS="-L#{opt_lib}/c++ -Wl,-rpath,#{opt_lib}/c++"
EOS
end
end
[./Formula/llvm@15.rb]
def caveats
on_macos do
<<~EOS
To use the bundled libc++ please add the following LDFLAGS:
LDFLAGS="-L#{opt_lib}/c++ -Wl,-rpath,#{opt_lib}/c++"
EOS
end
end
[./Formula/gnu-time.rb]
def caveats
on_macos do
<<~EOS
GNU "time" has been installed as "gtime".
If you need to use it as "time", you can add a "gnubin" directory
to your PATH from your bashrc like:
PATH="#{opt_libexec}/gnubin:$PATH"
EOS
end
end
[./Formula/gnu-indent.rb]
def caveats
on_macos do
<<~EOS
GNU "indent" has been installed as "gindent".
If you need to use it as "indent", you can add a "gnubin" directory
to your PATH from your bashrc like:
PATH="#{opt_libexec}/gnubin:$PATH"
EOS
end
end
[./Formula/ed.rb]
def caveats
on_macos do
<<~EOS
All commands have been installed with the prefix "g".
If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
PATH="#{opt_libexec}/gnubin:$PATH"
EOS
end
end
[./Formula/golo.rb]
def caveats
if ENV["SHELL"].include? "zsh"
<<~EOS
For ZSH users, please add "golo" in yours plugins in ".zshrc"
EOS
end
end
[./Formula/findutils.rb]
def caveats
on_macos do
<<~EOS
All commands have been installed with the prefix "g".
If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
PATH="#{opt_libexec}/gnubin:$PATH"
EOS
end
end
[./Formula/synergy-core.rb]
def caveats
# Because we used `license :cannot_represent` above, tell the user how to
# read the license.
s = <<~EOS
Read the synergy-core license here:
#{opt_prefix}/LICENSE
EOS
# The binaries built by brew are not signed by a trusted certificate, so the
# user may need to revoke all permissions for 'Accessibility' and re-grant
# them when upgrading synergy-core.
on_macos do
s += "\n" + <<~EOS
Synergy requires the 'Accessibility' permission.
You can grant this permission by navigating to:
System Preferences -> Security & Privacy -> Privacy -> Accessibility
If Synergy still doesn't work, try clearing the 'Accessibility' list:
sudo tccutil reset Accessibility
You can then grant the 'Accessibility' permission again.
You may need to clear this list each time you upgrade synergy-core.
EOS
end
s
end
[./Formula/nu.rb]
def caveats
on_macos do
<<~EOS
Nu.framework was installed to:
#{frameworks}/Nu.framework
You may want to symlink this Framework to a standard macOS location,
such as:
ln -s "#{frameworks}/Nu.framework" /Library/Frameworks
EOS
end
end
[./Formula/swift.rb]
def caveats
on_macos do
<<~EOS
An Xcode toolchain has been installed to:
#{opt_prefix}/Swift-#{version.major_minor}.xctoolchain
This can be symlinked for use within Xcode:
ln -s #{opt_prefix}/Swift-#{version.major_minor}.xctoolchain ~/Library/Developer/Toolchains/Swift-#{version.major_minor}.xctoolchain
EOS
end
end
[./Formula/gnu-units.rb]
def caveats
on_macos do
<<~EOS
All commands have been installed with the prefix "g".
If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
PATH="#{opt_libexec}/gnubin:$PATH"
EOS
end
end
[./Formula/libtool.rb]
def caveats
on_macos do
<<~EOS
All commands have been installed with the prefix "g".
If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
PATH="#{opt_libexec}/gnubin:$PATH"
EOS
end
end
[./Formula/percona-server.rb]
def caveats
s = <<~EOS
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -uroot
EOS
if (my_cnf = ["/etc/my.cnf", "/etc/mysql/my.cnf"].find { |x| File.exist? x })
s += <<~EOS
A "#{my_cnf}" from another install may interfere with a Homebrew-built
server starting up correctly.
EOS
end
s
end
[./Formula/gdb.rb]
def caveats
on_macos do
<<~EOS
gdb requires special privileges to access Mach ports.
You will need to codesign the binary. For instructions, see:
https://sourceware.org/gdb/wiki/PermissionsDarwin
EOS
end
end
[./Formula/make.rb]
def caveats
on_macos do
<<~EOS
GNU "make" has been installed as "gmake".
If you need to use it as "make", you can add a "gnubin" directory
to your PATH from your bashrc like:
PATH="#{opt_libexec}/gnubin:$PATH"
EOS
end
end
[./Formula/postgresql@14.rb]
def caveats
caveats = ""
# Extract the version from the formula name
pg_formula_version = version.major.to_s
# ... and check it against the old data dir postgres version number
# to see if we need to print a warning re: data dir
if old_postgresql_datadir_version == pg_formula_version
caveats += <<~EOS
Previous versions of postgresql shared the same data directory.
You can migrate to a versioned data directory by running:
mv -v "#{old_postgres_data_dir}" "#{var/name}"
(Make sure PostgreSQL is stopped before executing this command)
EOS
end
caveats += <<~EOS
This formula has created a default database cluster with:
initdb --locale=C -E UTF-8 #{postgresql_datadir}
For more details, read:
https://www.postgresql.org/docs/#{version.major}/app-initdb.html
EOS
caveats
end
[./Formula/openjdk@17.rb]
def caveats
on_macos do
<<~EOS
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn #{opt_libexec}/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk
EOS
end
end
[./Formula/openj9.rb]
def caveats
on_macos do
<<~EOS
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn #{opt_libexec}/openj9.jdk /Library/Java/JavaVirtualMachines/openj9.jdk
EOS
end
end
[./Formula/csound.rb]
def caveats
caveats = <<~EOS
To use the Java bindings, you may need to add to your shell profile
e.g. ~/.profile or ~/.zshrc:
export CLASSPATH="#{opt_libexec}/csnd6.jar:."
and link the native shared library into your Java Extensions folder:
EOS
on_macos do
caveats = <<~EOS
#{caveats}\
mkdir -p ~/Library/Java/Extensions
ln -s "#{opt_libexec}/lib_jcsound6.jnilib" ~/Library/Java/Extensions
EOS
end
on_linux do
caveats = <<~EOS
srconv is not installed because it conflicts with binutils. To run srconv:
csound --utility=srconv
#{caveats}\
sudo mkdir -p /usr/java/packages/lib
sudo ln -s "#{opt_libexec}/lib_jcsound6.jnilib" /usr/java/packages/lib
EOS
end
caveats
end
[./Formula/llvm.rb]
def caveats
on_macos do
<<~EOS
To use the bundled libc++ please add the following LDFLAGS:
LDFLAGS="-L#{opt_lib}/c++ -Wl,-rpath,#{opt_lib}/c++"
EOS
end
end
[./Formula/fontforge.rb]
def caveats
on_macos do
<<~EOS
This formula only installs the command line utilities.
FontForge.app can be downloaded directly from the website:
https://fontforge.github.io
Alternatively, install with Homebrew Cask:
brew install --cask fontforge
EOS
end
end
[./Formula/ruby@2.7.rb]
def caveats
return unless latest_version_installed?
<<~EOS
By default, binaries installed by gem will be placed into:
#{rubygems_bindir}
You may want to add this to your PATH.
EOS
end
[./Formula/openjdk@8.rb]
def caveats
on_macos do
<<~EOS
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn #{opt_libexec}/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-8.jdk
EOS
end
end
[./Formula/ruby.rb]
def caveats
return unless latest_version_installed?
<<~EOS
By default, binaries installed by gem will be placed into:
#{rubygems_bindir}
You may want to add this to your PATH.
EOS
end
[./Formula/ocl-icd.rb]
def caveats
s = "The default vendors directory is #{etc}/OpenCL/vendors\n"
on_linux do
s += <<~EOS
No OpenCL implementation is pre-installed, so all dependents will require either
installing a compatible formula or creating an ".icd" file mapping to an externally
installed implementation. Any ".icd" files copied or symlinked into
`#{etc}/OpenCL/vendors` will automatically be detected by `ocl-icd`.
A portable OpenCL implementation is available via the `pocl` formula.
EOS
end
s
end
[./Formula/grep.rb]
def caveats
on_macos do
<<~EOS
All commands have been installed with the prefix "g".
If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
PATH="#{opt_libexec}/gnubin:$PATH"
EOS
end
end
[./Formula/ruby@3.1.rb]
def caveats
return unless latest_version_installed?
<<~EOS
By default, binaries installed by gem will be placed into:
#{rubygems_bindir}
You may want to add this to your PATH.
EOS
end
[./Formula/mercurial.rb]
def caveats
return unless (opt_bin/"hg").exist?
cacerts_configured = `#{opt_bin}/hg config web.cacerts`.strip
return if cacerts_configured.empty?
<<~EOS
Homebrew has detected that Mercurial is configured to use a certificate
bundle file as its trust store for TLS connections instead of using the
default OpenSSL store. If you have trouble connecting to remote
repositories, consider unsetting the `web.cacerts` property. You can
determine where the property is being set by running:
hg config --debug web.cacerts
EOS
end
[./Formula/vis.rb]
def caveats
on_macos do
<<~EOS
To avoid a name conflict with the macOS system utility /usr/bin/vis,
this text editor must be invoked by calling `vise` ("vis-editor").
EOS
end
end
[./Formula/freerdp.rb]
def caveats
extra = ""
on_macos do
extra = <<~EOS
XQuartz provides an XServer for macOS. The XQuartz can be installed
as a package from www.xquartz.org or as a Homebrew cask:
brew install --cask xquartz
EOS
end
<<~EOS
xfreerdp is an X11 application that requires an XServer be installed
and running. Lack of a running XServer will cause a "$DISPLAY" error.
#{extra}
EOS
end
[./Formula/openjdk@11.rb]
def caveats
on_macos do
<<~EOS
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn #{opt_libexec}/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk
EOS
end
end
[./Formula/postgresql@12.rb]
def caveats
caveats = ""
# Extract the version from the formula name
pg_formula_version = version.major.to_s
# ... and check it against the old data dir postgres version number
# to see if we need to print a warning re: data dir
if old_postgresql_datadir_version == pg_formula_version
caveats += <<~EOS
Previous versions of postgresql shared the same data directory.
You can migrate to a versioned data directory by running:
mv -v "#{old_postgres_data_dir}" "#{postgresql_datadir}"
(Make sure PostgreSQL is stopped before executing this command)
EOS
end
caveats += <<~EOS
This formula has created a default database cluster with:
initdb --locale=C -E UTF-8 #{postgresql_datadir}
For more details, read:
https://www.postgresql.org/docs/#{version.major}/app-initdb.html
EOS
caveats
end
[./Formula/coreutils.rb]
def caveats
msg = "Commands also provided by macOS and the commands #{breaks_macos_users.join(", ")}"
on_linux do
msg = "All commands"
end
<<~EOS
#{msg} have been installed with the prefix "g".
If you need to use these commands with their normal names, you can add a "gnubin" directory to your PATH with:
PATH="#{opt_libexec}/gnubin:$PATH"
EOS
end
[./Formula/opencl-icd-loader.rb]
def caveats
s = "The default vendors directory is #{etc}/OpenCL/vendors\n"
on_linux do
s += <<~EOS
No OpenCL implementation is pre-installed, so all dependents will require either
installing a compatible formula or creating an ".icd" file mapping to an externally
installed implementation. Any ".icd" files copied or symlinked into
`#{etc}/OpenCL/vendors` will automatically be detected by `opencl-icd-loader`.
A portable OpenCL implementation is available via the `pocl` formula.
EOS
end
s
end
[./Formula/mysql@5.7.rb]
def caveats
s = <<~EOS
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -uroot
EOS
if (my_cnf = ["/etc/my.cnf", "/etc/mysql/my.cnf"].find { |x| File.exist? x })
s += <<~EOS
A "#{my_cnf}" from another install may interfere with a Homebrew-built
server starting up correctly.
EOS
end
s
end
[./Formula/podman.rb]
def caveats
on_linux do
<<~EOS
You need "newuidmap" and "newgidmap" binaries installed system-wide
for rootless containers to work properly.
EOS
end
on_macos do
<<-EOS
In order to run containers locally, podman depends on a Linux kernel.
One can be started manually using `podman machine` from this package.
To start a podman VM automatically at login, also install the cask
"podman-desktop".
EOS
end
end
[./Formula/gnu-sed.rb]
def caveats
on_macos do
<<~EOS
GNU "sed" has been installed as "gsed".
If you need to use it as "sed", you can add a "gnubin" directory
to your PATH from your bashrc like:
PATH="#{opt_libexec}/gnubin:$PATH"
EOS
end
end
[./Formula/postgresql@13.rb]
def caveats
caveats = ""
# Extract the version from the formula name
pg_formula_version = version.major.to_s
# ... and check it against the old data dir postgres version number
# to see if we need to print a warning re: data dir
if old_postgresql_datadir_version == pg_formula_version
caveats += <<~EOS
Previous versions of postgresql shared the same data directory.
You can migrate to a versioned data directory by running:
mv -v "#{old_postgres_data_dir}" "#{postgresql_datadir}"
(Make sure PostgreSQL is stopped before executing this command)
EOS
end
caveats += <<~EOS
This formula has created a default database cluster with:
initdb --locale=C -E UTF-8 #{postgresql_datadir}
For more details, read:
https://www.postgresql.org/docs/#{version.major}/app-initdb.html
EOS
caveats
end
[./Formula/openconnect.rb]
def caveats
s = <<~EOS
A `vpnc-script` has been installed at #{etc}/vpnc/vpnc-script.
EOS
s += if (etc/"vpnc/vpnc-script.default").exist?
<<~EOS
To avoid destroying any local changes you have made, a newer version of this script has
been installed as `vpnc-script.default`.
EOS
end.to_s
s
end
[./Formula/gnu-tar.rb]
def caveats
on_macos do
<<~EOS
GNU "tar" has been installed as "gtar".
If you need to use it as "tar", you can add a "gnubin" directory
to your PATH from your bashrc like:
PATH="#{opt_libexec}/gnubin:$PATH"
EOS
end
end
[./Formula/gnu-which.rb]
def caveats
on_macos do
<<~EOS
GNU "which" has been installed as "gwhich".
If you need to use it as "which", you can add a "gnubin" directory
to your PATH from your bashrc like:
PATH="#{opt_libexec}/gnubin:$PATH"
EOS
end
end
[./Formula/emscripten.rb]
def caveats
return unless File.exist?("#{Dir.home}/.emscripten")
return if (libexec/".emscripten").exist?
<<~EOS
You have a ~/.emscripten configuration file, so the default configuration
file was not generated. To generate the default configuration:
rm ~/.emscripten
brew postinstall emscripten
EOS
end
[./Formula/ruby@3.0.rb]
def caveats
return unless latest_version_installed?
<<~EOS
By default, binaries installed by gem will be placed into:
#{rubygems_bindir}
You may want to add this to your PATH.
EOS
end
[./Formula/mmseqs2.rb]
def caveats
on_intel do
"MMseqs2 requires at least SSE4.1 CPU instruction support." unless Hardware::CPU.sse4?
end
end
[./Formula/neko.rb]
def caveats
s = ""
if HOMEBREW_PREFIX.to_s != "/usr/local"
s << <<~EOS
You must add the following line to your .bashrc or equivalent:
export NEKOPATH="#{HOMEBREW_PREFIX}/lib/neko"
EOS
end
s
end
[./Formula/inetutils.rb]
def caveats
s = ""
on_macos do
s += <<~EOS
Only the following commands have been installed without the prefix 'g'.
#{noshadow.sort.join("\n ")}
If you really need to use other commands with their normal names,
EOS
end
on_linux do
s += <<~EOS
The following commands have been installed with the prefix 'g'.
#{linux_conflicts.sort.join("\n ")}
If you really need to use these commands with their normal names,
EOS
end
s += <<~EOS
you can add a "gnubin" directory to your PATH from your bashrc like:
PATH="#{opt_libexec}/gnubin:$PATH"
EOS
s
end
[./Formula/llvm@13.rb]
def caveats
on_macos do
<<~EOS
To use the bundled libc++ please add the following LDFLAGS:
LDFLAGS="-L#{opt_lib}/c++ -Wl,-rpath,#{opt_lib}/c++"
EOS
end
end
[./Formula/samba.rb]
def caveats
on_macos do
<<~EOS
To avoid conflicting with macOS system binaries, some files were installed with non-standard name:
- smbd: #{HOMEBREW_PREFIX}/sbin/samba-dot-org-smbd
- profiles: #{HOMEBREW_PREFIX}/bin/samba-dot-org-profiles
EOS
end
end
[./Formula/mono.rb]
def caveats
s = <<~EOS
To use the assemblies from other formulae you need to set:
export MONO_GAC_PREFIX="#{HOMEBREW_PREFIX}"
EOS
on_arm do
s += <<~EOS
`mono` does not include MSBuild on Apple Silicon as current version
requires .NET 5 but Apple Silicon support was added in .NET 6.
If you need a complete package, then install via Rosetta or as a Cask.
EOS
end
s
end
[./Formula/neovim.rb]
def caveats
return if latest_head_version.blank?
<<~EOS
HEAD installs of Neovim do not include any tree-sitter parsers.
You can use the `nvim-treesitter` plugin to install them.
EOS
end
@apainintheneck
Copy link
Author

The full list of the 57 affected formulae is below.

  • apcupsd
  • coreutils
  • csound
  • ed
  • emscripten
  • findutils
  • firefoxpwa
  • fontforge
  • freerdp
  • gawk
  • gdb
  • gnu-indent
  • gnu-sed
  • gnu-tar
  • gnu-time
  • gnu-units
  • gnu-which
  • golo
  • grep
  • inetutils
  • libtool
  • llvm
  • llvm@13
  • llvm@14
  • llvm@15
  • make
  • mercurial
  • mmseqs2
  • mono
  • mysql
  • mysql@5.7
  • neko
  • neovim
  • nu
  • ocl-icd
  • opencl-icd-loader
  • openconnect
  • openj9
  • openjdk
  • openjdk@11
  • openjdk@17
  • openjdk@8
  • percona-server
  • podman
  • postgresql@12
  • postgresql@13
  • postgresql@14
  • ruby
  • ruby@2.7
  • ruby@3.0
  • ruby@3.1
  • samba
  • swift
  • synergy-core
  • util-linux
  • uutils-coreutils
  • vis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment