39

I get the following message when opening the terminal on mac

Last login: Tue Mar 11 14:33:24 on console login(291,0x7fff78af9310) malloc: * error for object 0x7f974be006f0: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug

[Process completed]

... and I don't seem to be able to escape it. I've been having some weird permissions problems with Adobe CC - could the two be symptoms of a single problem?

dan
  • 1,030
  • 1
  • 9
  • 24
  • I have a MAC OS X Mavericks too.I have followed all the steps but my problem is not going away.I updated the permissions on /Users/ folder and not /usr/bin folder.Are there separate steps for that – Abhijeet Kushe Mar 23 '15 at 18:40
  • having the same issue, recently installed adobe as well, though I also attempted to update ruby, - which wouldn't work as I ddin't have permissions for usr/bin directory, I chown'ed the usr/bin directory, and after closing and opening the terminal again I get the same error. – bigmadwolf Apr 07 '15 at 08:59
  • macports rsync gives the same error when using the -X option; see https://trac.macports.org/ticket/50350. In that case it is not a permissions problem. – ShadSterling Feb 08 '16 at 19:35

5 Answers5

77

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;
Vlad Papko
  • 13,184
  • 4
  • 41
  • 57
  • I ended up reformatting the whole machine, but will keep this as a reference for the future, thanks. Out of interest, do you know how the dangling pointer message relates to permissions? – dan Apr 28 '14 at 12:54
  • @RADan No, I found this relation empirically: I've made such changes in permissions of usr/bin dir and after it Terminal became to show error like in you question. Also I found related topic on Apple developers forum where was described the same problem. – Vlad Papko Apr 28 '14 at 14:06
  • 1
    As mentioned in another answer, I couldn't find any com.apple.terminal.plist in the ~/Library/Preference folder, but repairing permissions worked for me. Also as mentioned in another comment, I was messing with permissions when the issue started happening. – John B Oct 17 '14 at 17:07
  • @JohnBubriski, if you haven't this file you can simply ignore this step. – Vlad Papko Oct 18 '14 at 00:04
  • 2
    Unless you can show that deleting the Terminal preferences makes a difference, I can’t see how it could relate to this. Obviously, if you’ve customized your preferences to change shells, and the problem is in the shell, then changing the shell preference would work around the issue. But in general, deleting Terminal preferences won’t solve a problem like this, as the issue is not in Terminal. I believe your step #1 is unnecessary and can be removed. – Chris Page Apr 06 '15 at 03:57
  • didn't delete the plist but using the disk utility seemed to sort it out. thanks. (this is on yeosimite) – bigmadwolf Apr 07 '15 at 09:00
  • Hey, any solution to this on El Capitan? Disk Utility does not have that function anymore. – hpm Jan 12 '16 at 03:59
  • @Hyperum, try to use `First Aid` option (top left icon) in Disk Utility. Looks like it does the same as `Repair Disk Permissions`. Let me know if it works. I will update answer then. – Vlad Papko Jan 12 '16 at 16:13
  • @Visput, tried it twice, both from recovery mode and normal. Doesn't seem to work. – hpm Jan 12 '16 at 22:41
  • 1
    @Hyperum, I have updated answer. Take a look if it works for you. – Vlad Papko Jan 13 '16 at 00:51
  • @Visput Hey, thanks a lot! I definitely did not know about that. I'll accept it shortly, in a few hours. – hpm Jan 13 '16 at 01:24
21

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

P-A
  • 1,161
  • 12
  • 16
  • I ran the "Repair Disk Permissions" tool and saw these errors, "User differs on "usr"; should be 0; user is 501". What does that mean? Obviously something to do with the permissions but can someone explain further? – Adam Mendoza Dec 22 '14 at 03:56
  • Unless someone can show that deleting the Terminal preferences makes a difference, I can’t see how it could relate to this. Obviously, if you’ve customized your preferences to change shells, and the problem is in the shell, then changing the shell preference would work around the issue. But in general, deleting Terminal preferences won’t solve a problem like this, as the issue is not in Terminal. – Chris Page Apr 06 '15 at 03:57
  • Hey, any solution to this on El Capitan? Disk Utility does not have that function anymore. – hpm Jan 12 '16 at 03:59
1

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!

Austin
  • 11
  • 1
0

I tried running the Disk Utility and it kept crashing. I had to run it from OSX Recovery Mode.

You can enter OSX Recovery Mode during system boot by holding down CMD ⌘+R as your mac is booting up. Choose Disk Utility when it reaches the Recovery Options screen.

Shanimal
  • 11,517
  • 7
  • 63
  • 76
  • 1
    This solution worked for me, if it didn't work for you, it helps *everyone* if you add a comment about why you downvoted it. If this answer caused problems I would like to know so I have enough information to either delete my answer (so it's not harmful) or improve my answer so it's helpful to others. Thanks! – Shanimal Nov 16 '17 at 07:05
0

I had the same problem with my dev machine. After several hours of trying anything other than a reinstall I finally realized that was the only choice. It should have been the FIRST choice. SO EASY!

  • Back up the critical data (just in case)
  • Enter the recovery mode by pressing cmd+r at start up
  • Choose "Reinstall Mac OS X"

That's it. When my computer restarted I was prompted for my Apple ID credentials and then my user loaded like normal, with a working Terminal, even. I didn't need to reinstall / restore anything. The whole process (including the user folder backup) took about 45 min.

Final step, remove all of the sketchy utilities installed trying to fix this without a reinstall.

Aaron Luman
  • 635
  • 1
  • 10
  • 29