Software⏱️ 3 min read📅 2026-06-11

How to Fix: Symlink error when installing MySQL via Homebrew

Error installing MySQL via Homebrew due to permissions issue.

Quick Answer: Change the permissions of /usr/local/include to allow writing.

The symlink error when installing MySQL via Homebrew can be frustrating, especially for developers who rely on this tool for their projects. This error occurs when the linking step of the installation process fails to create a symbolic link to the MySQL library in the /usr/local directory.

This issue is usually caused by permissions problems with the /usr/local/include directory, which prevents Homebrew from creating the necessary symlink.

🔍 Why This Happens

  • The primary reason for this error is that the /usr/local/include directory has read-only permissions, preventing Homebrew from creating a writable symlink. This can happen if the system's default permissions are set to be too restrictive.
  • Another possible cause is that there is an existing file or directory in the /usr/local/include directory with the same name as the one required by MySQL, causing a naming conflict.

🛠️ Step-by-Step Verified Fixes

Chaining the brew link command

  1. Step 1: To fix this issue, try chaining the brew link command to attempt to create the symlink. Run the following command in your terminal: `brew link mysql --force`.
  2. Step 2: This option forces Homebrew to overwrite any existing symlinks and recreate them from scratch.
  3. Step 3: If you encounter an error while running this command, try removing any existing symlinks or files in the /usr/local/include directory before attempting again.

Changing permissions on the /usr/local/include directory

  1. Step 1: Alternatively, you can change the permissions on the /usr/local/include directory to make it writable by Homebrew. To do this, run the following command in your terminal: `sudo chmod -R 755 /usr/local/include`.
  2. Step 2: This will grant execute, write, and read permissions to all users on the system.

🎯 Final Words

To resolve the symlink error when installing MySQL via Homebrew, try chaining the brew link command or changing the permissions on the /usr/local/include directory. If you continue to experience issues, consider reaching out to Homebrew support for further assistance.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions