Mac Terminal - 'pointer being freed was not allocated' error when opening terminal

Solution 1:

It looks like you don't have the right permissions on the /usr/bin directory.

Solution for OS X 10.11 (El Capitan) and later:

  1. Install Onyx 3.1.3 app (Free analog of Disk Utility)
  2. Choose 'Maintenance' -> 'Permissions' -> 'Execute'. enter image description here

Solution for older versions of OS X:

  • Open 'Disk Utility' app -> Press 'Repair Disk Permissions'.

It will set default permissions for the /usr/bin directory.
If this step doesn't help try this:

  • Delete com.apple.terminal.plist from the ~/Library/Preferences folder;

Solution 2:

Running on Mac OS X Mavericks just

  • Open "Disk Utility" app -> Press "Repair Disk Permissions"

Solved the problem

I couldn't find any com.apple.terminal.plist in the ~/Library/Preference folder

Solution 3:

I had a similar issue while running OSX 10.11.6. I got a similar error when I ran certain commands, but it did not force bash to exit. It just aborted the command.

I tried running Onyx and repairing disk permissions via command line with no results (along with about another 100 or so desperate "fixes").

Eventually, I tried upgrading to a newer version of bash, which fixed the problem. To do this:

brew install bash sudo -s echo /usr/local/bin/bash >> /etc/shells chsh -s /usr/local/bin/bash

Restart the computer.

I write this in the hopes that if someone else has this error they have one more fix to try!