Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cleaning semaphores in Mac OS X

I have a program that leaves some semaphores uncleaned and hence if i run it a couple of times, the program will seg fault. I used to use the following command in linux to clean them up.

ipcs -s | grep root |grep 666| cut -f2 -d' ' | xargs -I {} sudo ipcrm -s {}

but this doesnt work on mac. What command should i use to resolve this issue in mac osx?

like image 629
Prasanth Madhavan Avatar asked Sep 19 '25 07:09

Prasanth Madhavan


1 Answers

This worked for me on MacOS Ventura: I had to use an upper case -S for the key (third entry in the table)

ipcs -s | grep root | cut -f3 -d' ' | xargs -I {} sudo ipcrm -S {}

and the lower case -s with the id (second entry on the table)

ipcs -s | grep root | cut -f2 -d' ' | xargs -I {} sudo ipcrm -s {}

Replace root with another username or any other filtering.

like image 97
michael3.14 Avatar answered Sep 22 '25 16:09

michael3.14